Wrote yet another script to install an ISAPI extension. Been through this before, for a work project, and for a personal project.

Ran across the announcement of an FastCGI extension for IIS from Microsoft. This is good news as I happen to believe FastCGI is an excellent way of decoupling application function from the web server specifics. It seems that Microsoft’s original aim is to improve PHP performance.

FastCGI for IIS : Microsoft Internet Information Services Microsoft is excited to announce a technical preview release of FastCGI for IIS, a new component for Microsoft’s Web server platform.

BillS’ IIS Blog : PHP on IIS7 w/FastCGI To make sure anyone can take advantage of FastCGI on all of our existing platforms, we’ve built an ISAPI version of it that can run on Windows XP and Windows 2003 (IIS 5.1 and IIS 6.0) as well as a new module version for IIS 7.0. Check out the IIS FastCGI page for more information.

Wanted to take another crack at this as:

  • My familiarity using Javascript has improved considerably.
  • The fcgisetup.js script from Microsoft offers perhaps additional clues as to the “right” way of doing things.
  • Wanted to make better use of ADSI and WMI function for service control and configuration.

The fcgisetup.js script from Microsoft is a good example of Javascript written by a VBScript programmer, perhaps not the most brilliant use of Javascript. :)

By using Javascript more fully, was able to produce a slightly smaller fcgisetup.js script that does a bit more. The rewritten script runs on Windows 2003 Server, Windows XP Pro, and Windows 2000 (though Microsoft’s fcgiext.dll does not work on 2000). Changes include:

  • Uses ADSI and WMI exclusively to configure IIS and control services.
  • Eliminated use of external programs (iisreset and fcgiconfig).
  • The /v option provides a fairly complete trace of script actions.

Of course, I will offer the usual programmer’s conceit - that the new script is also more readable. :)

I did run into a couple puzzles. On Windows 2003 Server it is not possible to /install and /add in a single script invocation - some problem with ADSI (apparently). Not critical as you can just invoke the script twice:

cscript /nologo fcgisetup.js /install
cscript /nologo fcgisetup.js /add "c:\\program files\\php\\php-cgi.exe" php

Added NOTE: comments to the script to flag the troublesome bits on Windows 2003 Server.