Install PHP and FastCGI Support on Server Core
by IIS Team
FastCGI is a language-independent, scalable, open extension to Common Gateway Interface (CGI) that improves performance. The FastCGI extension is installable onto Server Core and enables application frameworks such as PHP to achieve improved performance and stability on Internet Information Services 7 (IIS 7) and above. Installing FastCGI when hosting PHP applications is very strongly recommended. In this example, we install FastCGI support to prepare the server to host our PHP application.
Install FastCGI Support
To install FastCGI and Static Content Web Server support, type the following text into the Server Core system's command line, and then press ENTER:
Start /w ocsetup IIS-WebServerRole
Type the following text into the Server Core system's command line and press ENTER:
Start /w ocsetup IIS-CGI
AppCmd.exe is the command-line tool included with IIS. AppCmd.exe can be found in the
%WinDir%\System32\InetSrvdirectory. Use AppCmd.exe commands to create the PHP/FastCGI handler mapping from the Server Core's command line (note that this is case sensitive):
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']
- Depending on the PHP installation location, paths to executables on the hard disk may require updates. Note that the AppCmd.exe example commands above assume that PHP installation is in the D:\PHP directory.
Install PHP on IIS 7 and Above
- Download the latest PHP release.
- In the section titled "Windows Binaries," select the archive with the .zip file extension. Note that the Server Core lacks a graphical user interface (GUI), and has no Web browser.
- Uncompress the archive's contents to a location accessible by the Server Core system, which is likely to be a network file share.
Create a directory in which to copy the uncompressed files, for example:
Copy the entire contents of the PHP archive you uncompressed previously into the
Execute the following command:
rename %SystemDrive%\PHP\PHP.INI-Recommended %SystemDrive%\PHP\PHP.INI
Test the PHP Configuration
From the command line, start Notepad.exe. In the empty file, type or paste the following text:
<?php phpinfo(); ?>
- Save the file as phpinfo.php to
- From a connected computer, open a browser window, and go to
A page appears showing the PHP configuration.
This article updates IIS 7.0 and Above on Server Core by Tobin Titus, published on September 11, 2009.