Introduction
FastCGI is a language-independent, scalable, open extension to CGI that provides high performance. The FastCGI extension is installable onto Server Core and enables application frameworks such as PHP to achieve improved performance and stability on IIS. Installing FastCGI when hosting PHP applications is very strongly recommended. In this example we will install FastCGI support to prepare the server to host our PHP application.
To install FastCGI and Static Content Web Server support, type the following text into the Server Core System's command-line
Start /w pkgmgr /iu:IIS-WebServerRole;IIS-WebServer;IIS-CommonHttpFeatures;IIS-StaticContent;IIS-DefaultDocument;IIS-DirectoryBrowsing;IIS-HttpErrors;IIS-ApplicationDevelopment;IIS-CGI;IIS-HealthAndDiagnostics;IIS-HttpLogging;IIS-LoggingLibraries;IIS-RequestMonitor;IIS-Security;IIS-RequestFiltering;IIS-HttpCompressionStatic;IIS-WebServerManagementTools;WAS-WindowsActivationService;WAS-ProcessModel
Create the PHP/FastCGI handler mapping from the command line by typing the following two AppCmd.exe commands:
AppCmd set config /section:system.webServer/fastCGI /+[fullPath='d:\php\php-cgi.exe']
AppCmd set config /section:system.webServer/handlers /+[name='PHP-FastCGI',path='*.php',verb='*',modules='FastCgiModule',scriptProcessor='d:\php\php-cgi.exe',resourceType='Either']
Note:
- AppCmd.exe is a new command-line tool included with IIS 7.0. AppCmd.exe can be found at %WinDir%\System32\InetSrv directory.
- Depending on the PHP installation location, paths to executables on the hard disk may require updates. All AppCmd example commands above assume that PHP installation is in D:\PHP folder.
Installing PHP on IIS 7.0
1. Download the latest PHP release from the following location:
http://www.php.net/downloads.php
2. In the section titled "Windows Binaries," choose the archive with the zip extension.
Note: The Server Core lacks a GUI interface, and has no Web browser.
3. Uncompress the archive's contents to a location accessible by the Server Core system, which will likely be a network file share.
4. Create a directory on which to copy the uncompressed files, for example:
%SystemDrive%\PHP
5. Copy the entire contents of the PHP archive you uncompressed previously into
%SystemDrive%\PHP
6. Execute the following command:
rename %SystemDrive%\PHP\PHP.INI-Recommended %SystemDrive%\PHP\PHP.INI
Testing the PHP Configuration
1. From the command line, launch notepad.exe. In the empty file, type or paste the following text:
<?
phpinfo();
?>
2. Save the file as phpinfo.php to the following location:
C:\inetpub\wwwroot\
3. From a connected computer, open a browser window, and point it to: http://%systemhost%/phpinfo.php
4. A page displays, showing the PHP configuration.

Comments