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:
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
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":
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 '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:
#!/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.
Running PHP as a CGI If you need to run an older version of PHP in order to maintain compatibility with your legacy software, you may run PHP as a CGI.
On average, the PHP version is faster than the ASP version, while the CGI (C++) version is more than 10 times faster than both PHP and ASP.
PHP CGI means using the PHP interpreter through CGI mode. The web server will pass the data from the request to PHP (an external program); its input is a PHP file (usually on the server) and its output is HTML code (usually rendered in the client's browser). PHP CGI configuration is set via PHP INI directives files.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With