How to override PHP configuration when working in CGI mode

There are several tutorials telling me how to override the PHP configuration when it runs in CGI mode. But I'm still confused because many of them assume that the server is running on Linux. Although I need to do this on Windows as well.

My hosting does use Linux, but my local development computer uses Windows XP with Xampp 1.7.3. So first I need to do this on my local computer, then I want to change the configuration on the hosting server.

PHP on my hosting server is already running as CGI, and on my local computer it still works as an Apache module.

At this point, the processes that I understand are as follows:

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

    # LoadFile "C:/xampp/php/php5ts.dll"
    # LoadModule php5_module modules/php5apache2_2.dll

  • My PHP now works as CGI. I checked this with phpinfo (). He tells me that the server API is now CGI / FastCGI. Now I want to override the php configuration.

  • Create the cgi-bin directory in DocumentRoot. My DocumentRoot is in "D: \ www \" (I use apache with a virtual host). So now this is "D: \ www \ cgi-bin".

  • Change the default "cgi-bin" directory "C: / xampp / cgi-bin /" to "D: \ www \ cgi-bin":

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

     <Directory "D:\www\cgi-bin"> Options MultiViews Indexes SymLinksIfOwnerMatch Includes ExecCGI AllowOverride All Allow from All </Directory> 
  • Copy the file "php.ini" to "D: \ www \ cgi-bin" and change the upload_max_filesize parameter from 128M to 10M.

  • Create the file "php.cgi" in "D: \ www \ cgi-bin" and put this code inside the file:

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

What is it. I am stuck on this issue. All the tutorials tell me to create a “php.cgi” file and put the shell code inside the file.

How to make the 6th step in Windows? I know that the next step is to create a handler in the .htaccess file to load this "php.cgi".

And also, because I will also need to change the PHP configuration on my hosting server (Linux), in the sixth step above to the right? Some textbook says insert these lines, and not above:

 #!/bin/sh export PHPRC=/site/ini/1 exec /cgi-bin/php5.cgi 

I apologize if my question is not clear. I am a new member, and this is my first question on this site.

Thanks.

+6
windows php apache configuration cgi
source share
1 answer

If your server already runs PHP as cgi, and you do not need to run multiple PHP configurations, steps 5 and 6 are not needed. Just change the default value of php.ini

+1
source share

All Articles