Installing PHP 5.x on Windows 2003 Std with FastCGI
I couldn’t find a concise guide on how to install PHP 5.x on Windows 2003 with FastCGI extensions until I found this blog.
To summarise, here is what is needed
1. Download FastCGI component and PHP5.x NTS zip ( NTS = non thread safe, and make sure you do NOT download the PHP installer .exe, just the zip file. )Note : The installer seems to do the IIS / OS setup part for you, which is nice, but doesn’t include the extensions necessary for PHP. Why this is, I don’t know. I personally think it is better to set it up manually anyway. Someone correct me if I am wrong.
2. Unzip PHP to a directory of your choosing e.g. D:\PHP5.x
- Once uninstalled, rename the “php-ini.recommended” to “php.ini”. You can then make your own modifications as per your specifications but at a minmum you probably want to enable PHP error logging
error_reporting = E_ALL
log_errors = On
error_log = ”d:\php\errors\error.log”’
3. Run the FastCGI installer and let it do its thing.
4. Run the following command from the installation directory for FastCGI c:\windows\system32\inetsrv\
cscript fcgiconfig.js -add -section:”PHP” -extension:php -path:”C:\PHP\php-cgi.exe”
5. Extra FastCGI configuration.
- Make the following changes to your PHP.ini
cgi.force_redirect = 0
- Set the FastCGI configuration settings for the PHP section by running fcgiconfig.js as follows:
cscript fcgiconfig.js -set -section:”PHP” -InstanceMaxRequests:10000
- Configure the FastCGI extension to set PHP_FCGI_MAX_REQUESTS environment variables for the PHP process to 10000.This setting instructs php-cgi.exe to recycle itself after it has processed 10000 requests successfully.
cscript fcgiconfig.js -set -section:”PHP” -EnvironmentVars:PHP_FCGI_MAX_REQUESTS:10000
6. Add appropriate MIME header types to IIS
Extension = .php | MIME Type = text/html
7. Test with a php page ( e.g phpinfo(); )