Installing PHP / IIS 7 on Windows 7
Table of Contents

1. Install Internet Information Services (IIS) by selecting `Start`, `Control Panel`, `Programs`, `Turn Windows features on or off`.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-productiontoC:\php\php.iniand open it with a text editor. -
Configure the CGI- and FastCGI-specific settings by un-commenting the following variables
fastcgi.impersonate = 1fastcgi.logging = 0cgi.fix_pathinfo = 1cgi.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, selectPathand 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
OKuntil 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
inetmgrin the Start Search box and then pressing the ENTER key. - Click
-
Double-click on
Handler Mappingsicon. -
From the Actions panel, click on
Add Module Mapping…- Under Request Path type
*.php - Under Module select
FastCgiModule. IfFastCgiModuleis missing on the list, then you must have missed selectingCGIduring installation of IIS in step 1. - Under Executable type navigate to the location where you extracted PHP and select
php-cgi.exeor just type the location plus php-cgi.exe. (C:\php\php-cgi.exe) - Under Name type
PHP-FastCGIand click OK. - Click on
Request Restrictions...and selectInvoke handler only if request is mapped to: - Select
File or Folderoption and clickOK. - Click
OKon theAdd Module Mappingdialog and answerYesto the dialog that appears.
- Under Request Path type
-
Set
index.phpas a default document in IIS.- Click on the
Homeicon to return to the IIS Manager main screen - Double click on the
Default Documenticon - From the
Actionspanel, click onAdd… - Under Name type
index.phpand click OK
- Click on the
-
Testing the PHP installation
- Create a simple
index.phpfile 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.phpfrom your web root folder
- Create a simple