David Huby’s Blog Technical and business stuff

20Dec/080

Installing PHP 5 on IIS 6 on 64 bit Windows

When setting up this blog on my new VPS, I had some trouble configuring PHP 5 on IIS6. I have installed PHP on Windows/IIS successfully a number of times in the past so this came as a surprise.

For the first time I was installing on an x64 operating system, and this does make a difference to the installation process.

Running PHP on 64-Bit Windows from the IIS Admin Blog noted the first issue was "trying to load a 32-bit application (in this case PHP) inside a 64-bit worker process"

In order to configure IIS to run in 32-bit mode you need to execute the following command :

cscript %SYSTEMDRIVE%\inetpub\adminscripts\adsutil.vbs
SET W3SVC/AppPools/Enable32bitAppOnWin64 1

There are a number of helpful steps and screenshots available at http://www.iisadmin.co.uk/?p=14

Secondly, I added PHP5 to my list of Web Service Extensions.
* Navigate to the IIS Manager in whichever management console you prefer (I usually run compmgmt.msc)
* Open the Web Service Extensions panel
* Etiher click "Add a new Web service extension..." or right click in the current pane and click on the context menu item of the same name.
* Type a sensible extension name such as PHP5 into the "Extension name" box
* Click Add and navigate to your copy of php5isapi.dll
* Check "Set extension status to Allowed"
* Click OK

The IIS Admin blog has an alternative way to do this (on the command line). From the article How To Install PHP on IIS 6.0:

cscript iisext.vbs /AddFile c:\PHP\php5isapi.dll 1 PHPISAPI 1 “PHP ISAPI”

Restart IIS if necessary, and PHP5 should be ready to go.

Tagged as: , , , No Comments