IT:AD:PHP:HowTo:Install on IIS
Summary
Not often that .NET dev's have to install PHP.
But I haven't found a better Wiki than IT:AD:DokuWiki yet.
Process
- Using Web Platform Installer:
- Go to http://php.iis.net/
- Takes ages, because it's installing dependencies first.
Using manual install
The WPI has advantages in that it ensures FastCGI is installed, and other dependencies.
But if you need to go manual (potentially because your network blocks large downloads via Web Platform Installer…I'm looking at you MOE (in 6/2013)), download
Configure prerequisites:
Ensure CGI is installed:
dism /online /enable-feature /featurename:IIS-CGI
You'll get:
Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft Corporation. All rights reserved. C:\Users\AdmSigalS>dism /online /enable-feature /featurename:IIS-CGI Deployment Image Servicing and Management tool Version: 6.1.7600.16385 Image Version: 6.1.7600.16385 Enabling feature(s) [==========================100.0%==========================] The operation completed successfully.
Download and install the MSI:
-
- Choose
VC9 x86 Non Thread Safeversion.- Look at Features to Install. The only one I had to turn on was LDAP one, as that's common in Enterprise environments.
The installer should take care of the following but it's very useful to know how to do the following…in case:
Map CGI to the Php.exe (in a CLI, not Powershell CLI):
appcmd set config /section:system.webServer/fastCGI /+[fullPath='C:\php\php-cgi.exe']
Setup the handler and module mapping for IIS7.5 so that it understands the available verbs and how to call PHP for request processing:
appcmd set config /section:system.webServer/handlers /+[name='PHP-FastCGI',path='*.php',verb='*',modules='FastCgiModule',scriptProcessor='C:\php\php-cgi.exe',resourceType='Either']
Test it with a page similar to:
<?php phpinfo(); ?>
If the FastCGI shuts down, install VC+ for VS2012 (choose 32 bit version, same as PHP…)