问题描述
有一些教程在那里,告诉我如何当它在CGI模式下运行PHP覆盖配置。但我仍然感到困惑,因为他们很多假设服务器运行在Linux上。虽然我需要做的同时在Windows上。
我的主机确实使用Linux,但我的本地开发计算机使用的是Windows XP且Xampp 1.7.3。所以,我需要做的,在我的本地计算机上的第一,那么我想改变托管服务器的配置。
在我的托管服务器的PHP已经在运行的CGI,而在我的本地计算机上运行还是作为Apache模块。
在这一点上,我了解流程是:
-
更改PHP在CGI模式下工作。我在的httpd-xampp.conf注释这两行这样做:
My PHP is now running as CGI. I checked this with phpinfo(). It tells me that the Server API is now CGI/FastCGI. Now I want to override php configuration.
Create "cgi-bin" directory in DocumentRoot. My DocumentRoot is in "D:\www\" (I'm using apache with virtual host). So it is now "D:\www\cgi-bin".
Change the default "cgi-bin" directory settings from "C:/xampp/cgi-bin/" to "D:\www\cgi-bin":
Copy 'php.ini' file to "D:\www\cgi-bin" and modify upload_max_filesize setting from 128M to 10M.
Create 'php.cgi' file in "D:\www\cgi-bin" and put these code inside the file:
That's it. I'm stuck at this point. All of tutorials tell me to create 'php.cgi' file and put shell code inside the file.
How to do the 6th step on Windows? I know the next step is to create handler in .htaccess file to load that 'php.cgi'.
And also, because I will also need to change PHP configuration on my hosting server (Linux), is the 6th step above right? Some tutorial tells to insert these lines instead of above:
#!/bin/sh
export PHPRC=/site/ini/1
exec /cgi-bin/php5.cgi
I'm sorry if my question is not clear. I'm a new member and this is my first question in this site.
Thank you.
If your server is already running PHP as cgi, and you do not need to run multiple PHP configurations, steps 5 and 6 are not necessary. Just change the default php.ini
这篇关于如何在CGI模式下运行时重写PHP配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!