Install PHP and FastCGI Support on Server Core
by IIS Team
Introduction
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\InetSrv
directory. 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:
%SystemDrive%\PHP
Copy the entire contents of the PHP archive you uncompressed previously into the
%SystemDrive%\PHP
directory.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
c:\inetpub\wwwroot\
.From a connected computer, open a browser window, and go to
http://%systemhost%/phpinfo.php
.A page appears showing the PHP configuration.
Note
This article updates IIS 7.0 and Above on Server Core by Tobin Titus, published on September 11, 2009.
See also
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for