read

Server Crash
For the past week or so, the server hosting the blog crashed bad and had to be sent in for repairs and the recovery process was a very tedious one. Kudos to the people over at 8toinfinity for working throughout the week to bring the server back into shape. The fortunate thing was that we didn’t lose data thanks to RAID mirroring and everything was more or less preserved.

Setting up PHP5 on IIS7 in Vista – My journey of exploration and discoveries
In the meantime I had attempted to set up PHP on IIS7 on my local machine to do some testing and ran into some issues with the latest version of PHP 5.25 Win32 installer while setting it up with IIS7 on Windows Vista. Apparently after using the installer, IIS7 on Windows Vista actually does not get modified properly to support PHP out of the box. A bit of disappointment there but I proceeded to remove PHP5 via the uninstaller and downloaded the zip package to do manual set up. That was where the problems set in. I kept getting an error where my IIS Worker Process kept crashing resulting in the Default App Pool to get shut off after repeated failures to launch a dll or exe. (Take note that im setting up FastCGI for PHP on IIS7).

Somehow after removal of PHP5 via the uninstaller and using the zipped version, PHP was still trying to use the php5isapi module although I had removed it from IIS completely (or so i thought). *Here is the error you might see although php5isapi had been seemingly removed: (IMPORTANT: The following are NOT steps to be followed for a clean installation of PHP on IIS7) *

Here is what you need to check:

Start >Run > “cmd” (Bring up your command prompt on Vista)

Navigate to your System32inetsrv folder (e.g. C:windowssystem32inetsrv)

Then execute the following command: “appcmd list config -section:globalmodules

You should see an XML list being shown that shows the installed modules in your IIS.

Look for this:

If it exists, it means php5 was NOT uninstalled properly. So we need to remove this entry before FastCGI will work.

Use the following commands:
C:WindowsSystem32inetsrv>appcmd set config -section:globalmodules /-[name=’php5isapi’]

If successful, you will get the following message:
Applied configuration changes to section “system.webServer/globalModules” for “MACHINE/WEBROOT/APPHOST” at configuration commit path “MACHINE/WEBROOT/APPHOST”

Try listing the modules again and the php5isapi node should be removed.
C:WindowsSystem32inetsrv>appcmd list config -section:globalmodules

With all these done, you can then proceed to set up FastCGI for PHP on IIS7 by

Running: fcgisetup.exe /install /add c:phpphp-cgi.exe php

from the directory on which you downloaded the FastCGI package.

This should set up PHP FastCGI on IIS7 automatically.

If your app pool was stopped (e.g. defaultAppPool), simply restart it in IIS7 and try to load the php page again. It should work.

You should see the following handler mappings in IIS7:

You should see that php-iisfgi is in the list, this means the PHP FastCGI module for  IIS7 is installed properly.

Lastly, just a few quick notes (this is nothing related to the above, but just a reminder just in case you were as silly as I were):

  1. For those who are unable to locate your php.ini and are about to bang your head (or have already banged your head on the desk)
    You have to add the path to your php.ini in an environmental variable called PHPRC not in the TEMP variable
  2. ISAPI and CGI support modules are not installed by default when you install IIS by just checking IIS in the program and features.
    Go back to Program and Features > Click on Turn Windows features on or off on the left sidebar and follow the following diagram making sure that ISAPI and CGI support is on. ( You can choose either depending on what PHP executable you are using )

Yep thats all I have for this post, hope this helps for  people trying to set up PHP5 using FastCGI on IIS7 :)

Cheers!

Blog Logo

alvin

0


Published

Image

1998 Nineteen-Ninety-Eight

Thoughts, stories and ideas.

Back to Overview