How to install FastCGI and PHP on IIS7 Beta 3 (Video)
Beta 3 release marks the first time the FastCGI feature has been a part of a Windows release, enabling PHP and other application frameworks to run on Windows with great performance and reliability. Making them a part of IIS and Windows means no more downloading and installing other components, or worrying about whether the tools you are using are supported, patched and ready for production use.
Video
A few weeks back I posted a video on how to get FastCGI and PHP up and running, and use it with the output caching feature that I blogged about earlier. I show off a quick performance demo in the video - it is a great way to see how big of a difference FastCGI and Output Caching can make! Here you go (requires Silverlight):
Or you can download it: getting PHP running on FAST on IIS7 Beta 3 - 11mins 5sec (Apple Quicktime, Windows Video)
Fast Facts
Here are some quick facts from the video on how to get FastCGI up and running:
Install path: IIS\World Web Web Services\Application Development Features\CGI (this will install both the legacy CGI as well as FastCGI modules)
Configuration: the FastCGI module registers itself in both the <globalModules> and <modules> section in \windows\system32\inetsrv\config\applicationHost.config, these rarely, if ever get touched. FastCGI also uses the <fastCGI> section, which is where fastCGI gets it application settings, and various configuration parameters like the number of CGI process to start, timeout values, etc. get set. When you register a new handler with fastCGI, that configuration gets written <handlers>, with a reference to the fastCGI module. here is a snapshot of all the relevant FastCGI configuration for one of my applications in applicationHost.config:
<globalModules>
<add name="iisfcgi" image="%windir%:\Windows\system32\inetsrv\iisfcgi.dll" />
<modules>
<add name="iisfcgi" />
<handlers accessPolicy="Script, Read">
<add name="php-iisfcgi" path="*.php" verb="GET,HEAD,POST" modules="iisfcgi" scriptProcessor="%systemdrive%:\php\php-cgi.exe" resourceType="Either" requireAccess="Script" />
<fastCGI>
<application fullPath="%systemdrive%:\php\php-cgi.exe" />
</fastCGI>
PHP install steps:
1) download the latest non-thread safe win32 binaries from http://www.php.net/downloads.php
2) unzip the package on to your hard drive (example: c:\php)
3) rename php.ini-dist to php.ini and set the extension_dir to c:\php\ext
4) enable any extensions that are required for your application, by uncommenting them - example:
extension=php_gd2.dll
5) register PHP with the FastCGI module. Mike covers this really well in this article.
The Using FastCGI to host PHP applications on IIS7 by Mike Volodarsky on iis.net covers all of this info, and more, in depth.
Share this post: email it! | bookmark it! | digg it! | reddit! | kick it! | live it!