Click the plus sign (+) to expand `Internet Information Services`, `World Wide Web Services` and `Application Development Features`. Under `Application Development Features`, make sure `NET Extensibility`, `ASP.NET`, `CGI, ISAPI Extensions`, `ISAPI Filters` and `Server-Side Includes` are selected.
-
Download PHP compressed files. Note that Non-thread-safe build of PHP is recommended when using IIS.
-
Extract the contents of compressed file to the hard disk. I this case I will extract to
C:\php
-
Rename the file
c:\php\php.ini-production
toC:\php\php.ini
and open it with a text editor. -
Configure the CGI- and FastCGI-specific settings by un-commenting the following variables
fastcgi.impersonate = 1
fastcgi.logging = 0
cgi.fix_pathinfo = 1
cgi.force_redirect = 0
-
Set directory for the loadable extensions. Find the
;extension_dir =”ext”
parameter. Uncomment it by removing the semi-colon (;
) and set its value to the directory where you extracted files in step 3 followed by\ext
. In my case the extensions folder will beC:\php\ext
. Save the file and exit the editor. -
Include PHP in PATH environmental variable using the following steps:
- Click on
Start
,Control Panel
,System and Security
- Click on
System
,Advanced system settings
- Under
Advanced tab
, click onEnvironmental Variables
- Under
System Variables
, selectPath
and click onEdit
… - Click at the end of the Variable value and type a semicolon followed by the location where you extracted the files in step 2. (
; c:\php
). - Click on
OK
until you’ve exited the System Properties window.
- Click on
-
Open IIS Manager from the Start menu
- Click
Start
, and then clickControl Panel
. - Click
System and Security
, and then clickAdministrative Tools
. - Double-click
Internet Information Services (IIS) Manager
.
A quicker way of opening the IIS Manager is by clicking on Start and typing
inetmgr
in the Start Search box and then pressing the ENTER key. - Click
-
Double-click on
Handler Mappings
icon. -
From the Actions panel, click on
Add Module Mapping…
- Under Request Path type
*.php
- Under Module select
FastCgiModule
. IfFastCgiModule
is missing on the list, then you must have missed selectingCGI
during installation of IIS in step 1. - Under Executable type navigate to the location where you extracted PHP and select
php-cgi.exe
or just type the location plus php-cgi.exe. (C:\php\php-cgi.exe
) - Under Name type
PHP-FastCGI
and click OK. - Click on
Request Restrictions...
and selectInvoke handler only if request is mapped to
: - Select
File or Folder
option and clickOK
. - Click
OK
on theAdd Module Mapping
dialog and answerYes
to the dialog that appears.
- Under Request Path type
-
Set
index.php
as a default document in IIS.- Click on the
Home
icon to return to the IIS Manager main screen - Double click on the
Default Document
icon - From the
Actions
panel, click onAdd
… - Under Name type
index.php
and click OK
- Click on the
-
Testing the PHP installation
- Create a simple
index.php
file with a single line:<?php phpinfo();?>
and save it inC:\inetpub\wwwroot folder
- Open your browser and enter
(http://localhost/)
and this should display information of the php installation. - Delete
index.php
from your web root folder
- Create a simple