How to Configure FastCGI on IIS 7 or 8 to Host PHP Applications

How to Configure FastCGI on IIS 7 or 8 to Host PHP Applications

1 Enable FastCGI Support in IIS 7 or 8

1.1 Enter Server Manager.

In Server Manager, click the Manage menu, and then click Add Roles and Features.

1.2 Confirm Installtion of  “CGI”

On the Server Roles page, expand Web Server (IIS), expand Web Server, expand Application Development, and then select CGI. Click “Next”.
 

1.3 On “Select Features” Page, Click “Next”. On the “Confirm Installation Selections” page, click “Install”. On Results Page, Click “Close”.

 

1.4 Installation is  successful.

2 Install and Configure PHP

To install and configure PHP in Windows 2008 and Windows 2012 R2, please access the article
“How to Install PHP in Windows2008 or 2012 Server”

3 Configure IIS 7 or 8 to Handle PHP Requests

3.1 Start IIS Manager

3.2 Click Server Name in the Left Panel, Double-Click 'Handler Mappings'.

 

3.3 In Actions Panel, click 'Add Module Mapping'.

3.4 Specify Configuration Settings

  1. Request path: *.php
  2. Module: FastCgiModule
  3. Executable: "C:\[Path to your PHP installation]\php-cgi.exe"
  4. Name: PHP via FastCGI
3.5 In “Add Module Mapping” Confirmation Dialog Box, click “Yes “

3.6 IIS 7 or 8 Handle PHP Requests Enabled

3.7 Test If It Works

Create a phpinfo.php file in the C:\inetpub\wwwroot folder that contains the following code.
Open a browser and navigate to http://localhost/phpinfo.php. If everything was setup correctly, you will see the standard PHP information page.

Add Feedback