开发者

How to override PHP configuration when running in CGI mode

There are some tutorials out there telling me how to override PHP configuration when it is running in CGI mode. But I'm still confused because lots of them assume that the server is running on Linux. While I need to do that also on Windows.

My hosting is indeed using Linux but my local development computer is using Windows XP with Xampp 1.7.3. So I need to do that in my local computer first, then I want to change the configuration on hosting server.

The PHP in my hosting server is already run as CGI while in my local computer still run as Apache module.

At this point, the processes that I understand are:

  1. Change PHP to work in CGI mode. I did this by commenting these two line in "httpd-xampp.conf":

    # LoadFile "C:/xampp/php/php5ts.dll"

    # LoadModule php5_module modules/php5apache2_2.dll

  2. 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.

  3. 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".

  4. Change the default "cgi-bin" directory settings from "C:/xampp/cgi-bin/" to "D:\www\cgi-bin":

    ScriptAlias /cgi-bin/ "D:/www/cgi-bin/"

    <Directory "D:\www\cgi-bin"开发者_如何学Python>
       Options MultiViews Indexes SymLinksIfOwnerMatch Includes ExecCGI
       AllowOverride All
       Allow from All
    </Directory>
    
  5. Copy 'php.ini' file to "D:\www\cgi-bin" and modify upload_max_filesize setting from 128M to 10M.

  6. Create 'php.cgi' file in "D:\www\cgi-bin" and put these code inside the file:

    #!/bin/sh

    /usr/local/cpanel/cgi-sys/php5 -c /home/user/public_html/cgi-bin/

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜