With all the hoopla about FastCGI on IIS I thought I'd give it a whirl. Here's what I did.
Installed Windows Server 2003 R2 Standard Edition.
Selected Application Server role. This installs IIS 6.
Setup autologin since this is a disposable virtual machine.
Fought IE7's draconian security popups to download Firefox.
Downloaded mysql-essential-5.0.45-win32.msi.
Downloaded php-5.2.4-nts-Win32.zip. (This non-thread-safe version is recommended to use FastCGI).
Extracted the contents to C:\php.
Went to My Computer - Properties - Advanced - Environmental Variables and added ,C:\php to the PATH variable.
Renamed php.ini-dist to php.ini. I used php.ini-dist since this is just a development box.
In php.ini:
- uncommented fastcgi.impersonate = 1 since I plan to run it with IIS.
- set doc_root = "C:\Inetpub"
- set session.save_path = "C:\php\sessiondata"
Opened port 80 in the firewall. I can now send a request to IIS and get back a response in my web browser. The response is an Under Construction page since I haven't set a default page in IIS yet. Made a index.htm file and said Hello World.
Downloaded FastCGI Extension for IIS6.0.
The End-User License Agreement includes this: "You may not disclose the results of any benchmark tests of the software to any third party without Microsoft's prior written approval". Thus you will not see any benchmarks from me.
And this: "If you give feedback about the software to Microsoft, you give to Microsoft, without charge, the right to use, share and commercialize your feedback in any way and for any purpose." Thus you will not see any feedback about the Microsoft FastCGI Extension for IIS 5.1 and 6.0 Go Live software from me.
Configured FastCGI according to these instructions.
My C:\WINDOWS\system32\inetsrv\fcgiext.ini file contains the minimum:
[Types]
php=PHP
[PHP]
ExePath=C:\php\php-cgi.exe
I created a basic hello.php file containing
<?php
echo "Hello world from PHP.";
?>
.
I can now do \php\php.exe \Inetpub\wwwroot\hello.php at the command line and it works.
But hitting it through IIS results in
FastCGI Error
The FastCGI Handler was unable to process the request.
Error Details:
- The FastCGI process exited unexpectedly
- Error Number: -2147467259 (0x80004005).
- Error Description: Unspecified error
HTTP Error 500 - Server Error.
Internet Information Services (IIS)
Using Rick James' Fake FastCGI Web Server to say
C:>fakefcgi.exe c:\Inetpub\wwwroot\hello.php c:\php\php-cgi.exe
I get
Fake FastCGI web server
FCGI_PARAMS sent
FCGI_STDIN sent
Launching receive loop
FCGI_STDOUT: Status: 404
X-Powered-By: PHP/5.2.4
Content-type: text/html
No input file specified.
FCGI_END_REQUEST received
killing app
FastCGI process exited with 0
I installed procmon and discovered that the IIS user (NETWORK SERVICE) did not have Execute access to C:\php\php5.dll. Once that was granted, my hello.php ran.
The next problem was that I wanted to set up Drupal, so clearly I need to run MySQL. But PHP would not load the C:\php\ext\php_mysqli.dll file. Again, a permissions issue solved by giving NETWORK SERVICE access. Clearly I must have missed the permissions section of the PHP installation docs.
Thanks to Drew Robbins of Microsoft for debugging the extension permissions issues.