Freigeben über


Deploying IIS 7.5 + FASTCGI + PHP on Server Core

FastCGI is a language-independent, scalable, open extension to CGI that provides high performance. The FastCGI extension is installable in Server Core and enables application frameworks such as PHP to achieve improved performance and stability on Internet Information Services. Watch for recorded demonstrations of the following instructions at MSDN Channel9.

Prerequisites

See how-to configure IIS 7.5 on Server Core at https://code.msdn.microsoft.com/r2coreaspnet

IIS 7.5 (Enable the following components)

  • IIS-WebServerRole
  • IIS-WebServer
  • IIS-CommonHttpFeatures
  • IIS-StaticContent
  • IIS-DefaultDocument
  • IIS-DirectoryBrowsing
  • IIS-HttpErrors
  • IIS-ApplicationDevelopment
  • IIS-HealthAndDiagnostics
  • IIS-HttpLogging
  • IIS-LoggingLibraries
  • IIS-RequestMonitor
  • IIS-Security
  • IIS-RequestFiltering
  • IIS-HttpCompressionStatic
  • IIS-WebServerManagementTools
  • WAS-WindowsActivationService
  • WAS-ProcessModel

The optional feature “ServerCore-WOW64” is enabled by default on Server Core.

Install FASTCGI and PHP on Server Core

1. Install FastCGI feature for IIS. Run the following command:

dism /online /enable-feature /featurename:IIS-CGI

2. Download the php binaries for windows from https://www.php.net/downloads.php.

3. Create a C:\php folder on Server Core.

4. Copy the php binaries to C:\php folder on Server Core.

clip_image002

Configure PHP on Server Core

1. We need to configure IIS7.5 to use PHP as a CGI execution environment. To do this, run the following command:

appcmd set config /section:system.webServer/fastCGI /+[fullPath='C:\php\php-cgi.exe']

2. The next thing we need to do is setup the handler and module mapping for IIS7.5 so that it understands the available verbs and how to call PHP for request processing. To do this, run the following command:

appcmd set config /section:system.webServer/handlers /+[name='PHP-FastCGI',path='*.php',verb='*',modules='FastCgiModule',scriptProcessor='C:\php\php-cgi.exe',resourceType='Either']

Test PHP on Server Core

1. Create an info.php file at C:\inetpub\wwwroot on Server Core with the following code:

<?php

phpinfo();

?>

2. Navigate to https://{serverCore}/info.php.

clip_image004