Installing Moodle 1.9 on WS2008 x64, IIS7, PHP 5.2, Postgresql 8.2 (pt 1)

Moodle is a free Learning Management System that is supported on various platforms. A lot of these big open source packages are primarily developed for Linux/Unix these days. If you are very blessed then someone has gone to the effort to produce a Windows port or installation package. Happily, that is becoming more and more common. We have just taken delivery of a new server running Windows Server 2008 64-bit and it comes with IIS7, which is a whole lot different from IIS6. I previously got PHP 5.2 running on IIS6 without much difficulty, but naturally, MS must make IIS7 new and more tricky to set up. These instructions that you can find on the web are now out of date as they apply to IIS6. There’s also a new choice in IIS7 and that is whether to use the ISAPI module of PHP or a new module provided by MS called FastCGI. I haven’t looked into this much yet and am concentrating on ISAPI for now because of my familiarity with it. An important point to note is that PHP and Postgresql are 32 bit applications. In the case of PHP, in particular, this may require IIS7 to have a specific configuration for 32 bit compatibility. Postgresql has finally (in my long experience of it) moved to a native Windows port which was historically not provided for by the developers. PHP has been available for IIS for some years but I found 4.x impossible to get working, whereas 5.x was relatively straightforward.

Installing a system like Moodle is a big project because it relies on all the various components and extensions which have to be got working together. It’s something I would prefer to pass the buck on. If only :). Although, I did get WordPress working nicely on the server last year (which was what used PHP at that time, as well as MySQL which was also relatively trouble free. However another project I looked at, which used Apache Tomcat, turned out to be too much trouble. It was a nice idea, but getting all the bits working together was just too difficult for someone not an expert in Java in particular, and maintaining it would be just as challenging. This year I’ll have a staff member working with me at our site who is an experienced DBA, and he’ll hopefully have a good grasp of running Moodle, so I think that will make a big difference to the use of the LMS in our site.

What I’ve been able to work out from translating the old IIS6 instructions for installing PHP on IIS7 on WS2008 x64 goes something like this:

  1. Install PHP:
    1. Install PHP 5.2.8 using the supplied installer. At this stage, I skipped installing PECL.
    2. Set up a Session state folder and change php.ini to point to it.
    3. Skipped installing extensions at this stage
    4. Checked the PHP path is set in the PATH environment
    5. Checked the Registry key points to php.ini
  2. Configure IIS: (ISAPI module)
    1. In IIS7 the first step is Handler Mappings. You add a Script mapping for the php5isapi.dll file for the extension of *.php. Set the Request Restrictions as follows: Restrict the verbs to GET, POST, HEAD, and set the Access level to Script.
    2. Also, go to ISAPI and CGI Restrictions and add an entry for the same ISAPI DLL to allow it to execute.
    3. Finally go to ISAPI Filters and add another entry for that DLL. This particular step is one I’m not terribly clear on the necessity of, but sometimes it is apparently necessary.
  3. At this stage trying to load a simple php file got me to a HTTP 404.17 error message, “The requested content appears to be script and will not be served by the static file handler”. I did a bit of poking around, and then tried going to Application Pools and enabling 32 bit applications on the advanced settings of the DefaultAppPool.
  4. This now gets me a “HTTP 500.19 – Internal Server Error. The requested page cannot be accessed because the related configuration data for the page is invalid.”
  5. Microsoft suggested giving IIS_IUSRS group permissions to read the config file for the server. I set this up, but it hasn’t changed the error message from 500.19

You can imagine we get grumpy because there are so many security related changes to these systems with Vista, with WS2008 and it makes for a steep learning curve and a whole lot more stuff we have to learn to get things running. Under WS2003, Moodle would practically be all installed by now. I am highly tempted to look at one of the other options for getting PHP running. I think I will just give it one more day to see what I can come up with on this option, and then try one of the other options, like IIS6 backward compatibility mode, or FastCGI.