Turbo-charge your PHP applications with IIS FastCGI Technical Preview 2
After 3 months of community feedback and development, the FastCGI Techical Preview 2 has just been released!
Before I jump into the juicy details, I want to thank everyone who has tried out the original release, and given us bug and feature feedback on the FastCGI forums. This has been incredibly valuable in driving the feature forward, and I look forward to more of it as we move towards FastCGI beta (more on this later in the post).
- 2/10/2007: The Windows-optimized PHP 5.2.1 is now available from www.php.net/downloads. Learn more about it here.
- 2/18/2007: Instructions on how to run Ruby on Rails with IIS FastCGI TP2 have been published.
First things first
The FastCGI Technical Preview 2 release is an update for the first ever release of Microsoft IIS FastCGI feature in October 2006, providing a platform for high-performance and reliable way to run application frameworks like PHP on IIS (see my other posts about FastCGI and PHP).
It is now available from the FastCGI main page on www.iis.net, with the following packages:
- FastCGI for IIS 5.x / IIS 6.0 - for Windows XP, and Windows Server 2003
- FastCGI for IIS 7 - for Windows Vista (RC1+), and Windows Server codenamed "Longhorn"
This release supports both 32-bit and 64-bit operating systems, so be sure to download the appropriate flavor of the package for your operating system. The 64-bit package will work "out of the box" in both native 64-bit and 32-bit WOW64 IIS application pools on your 64-bit Windows OS, so you dont need to worry about any additional configuration.
FastCGI Tech Preview 2 is fully compatible with PHP 5.2, currently available from www.php.net/downloads. You can install the FastCGI package and configure it to work with PHP by following the updated instructions in the updated Using IIS FastCGI with PHP article. It should also work with PHP 4, although we havent extensively tested it, so if you run into any issues, please report them on the Forums.
So, what am I getting?
The original technical preview release from October 30th of last year provided basic FastCGI functionality for running PHP applications. Technical Preview 2 contains the following bug fixes and enhancements:
- Native support for 64 bit Windows operating systems. The 64-bit packages provide full installation support for 64-bit OS, and enable both native 64-bit and 32-bit WOW64-based IIS applications. The FastCGI application, such as PHP, can be either 32 bit or 64 bit.
- Additional server variables used by PHP and other FastCGI frameworks. These include DOCUMENT_ROOT, REQUEST_URI, and SCRIPT_FILENAME.
- Support for PHP's fcgi.impersonate. This enables PHP applications on Windows to impersonate the authenticated user making the request, enabling the PHP scripts to execute as that user instead of the identity of the IIS worker process.
- Improved error handling. Added a number of error messages for common error conditions such as miconfiguration. This is primarily done in the IIS7 package version. Also, provided proper handling for FastCGI application errors, such as PHP script errors.
- Improved FastCGI application process management. The FastCGI component is now resilient to shutting down or killing the IIS worker process, or stopping the IIS service, making sure to terminate the child FastCGI application processes. This means that you should no longer see orphaned php-cgi.exe processes when you do any of the things above.
- Improved timeouts. Several changes to make the timeouts more flexible / correct, including the added the activityTimeout setting, which insures that the child FastCGI process remains responsive. Also added the idleTimeout setting, which controls how long the process can be idle before its terminated,
- Enabled the TCP transport mechanism. This provides support for TCP-based FastCGI application implementations.
- Removed the response entity-body, and request POST entity-body size limitations. Previously, internal constraints limited this to 1 Mb each.
- Support for passing command line arguments to FastCGI application processes. Allows FastCGI applications that require command line arguments to be specified to be used with the FastCGI feature.
- Experimental Ruby support. More on this including setup instructions in the next post!
Look to the next post for more details on the configuration options, and advanced functionality, including how to set up Ruby with FastCGI on IIS.
In order to use the FastCGI package, do the following:
- Download the appropriate FastCGI TP2 package for your IIS version (IIS6 vs. IIS7) and OS bitness (32-bit vs. 64-bit)
- Unzip it to a local directory on your machine
- Use fcgisetup.js (IIS6) or fcgisetup.exe (IIS7) to install it:
IIS6: cscript fcgisetup.js /install
IIS7: fcgisetup.exe /install
Note that the TP2 installation automatically replaces the TP1 installation if present. It also does not require TP1 to be installed.
- Then, configure FastCGI TP2 with your scripting environment, like PHP, for example:
IIS6: cscript fcgisetup.js /r /add c:phpphp-cgi.exe php
IIS7: fcgisetup.exe /add c:phpphp-cgi.exe php
This is the short of it. Please read the detailed how-to in the Use PHP with FastCGI article. If you need last minute reference, the instructions are also available in the included "readme.txt" file, and from the fcgisetup installer as command line help.
What's next? The FastCGI roadmap
The Technical Preview 2 release is still in the tech preview stage, and as such is not meant for production environments. It is an opportunity for us to get the fixes out to the community for evaluation, and gather more feedback as we move forward to a well-tested, stable beta release suitable for production environments.
We are hoping to be ready for the Beta release for both IIS6 and IIS7 platforms sometime around April. This is currently tentative, and since our first priority right now is getting IIS7 ready for primetime in Longhorn Server, plans may change. Keep watching the FastCGI forums and this blog for more news as time goes on.
Another incredibly exciting event is the anticipated arrival of PHP 5.2.1 (you can get the dev builds right now from www.php.net), which will contain the majority of Zend's core PHP fixes designed to significantly improve its performance on Windows. Combined with the IIS FastCGI feature, this should provide unparallelled PHP performance on the Windows / IIS platform. As soon as this is available, be sure to grab it - I will also post some performance numbers to show it off.
Now, go download the FastCGI Tech Preview and let me know how it goes. You can get support, and report issues on the IIS6 FastCGI forums and the IIS7 FastCGI forums. Watch my blog for more details over the next week ...
We are all looking forward to your feedback!