Big Long Fight with PHP and FastCGI

So it took a good 15 hours from start to finish with Server 2008.  This is why I don’t really like to do upgrades unless I absolutely have to.  I finally nailed down a configuration of Server 2003 that doesn’t crash or give me headaches, and here I am upgrading again!

To add insult to injury, it appears that one of my drives in the RAID 1 array failed, so I have to replace that.  That explains some of the weird error emails I got a few months ago that the array spontaneously started rebuilding itself.

Configuring PHP on Windows can be quite a deck of cards… I previously had an installation of PHP that worked, so I just copied the directories whenever I needed a new PHP install.  That was using PHP_ISAPI.  From what I’ve read, IIS 7 really likes to use FastCGI, for various performance reasons.

I tried several methods of installing PHP… copying old configs, installing an MSI… I tried installing and uninstalling, and tried CGI and ISAPI, and WordPress would not behave.  After much troubleshooting, I found a lot of modules weren’t being initialized… I won’t get into it, but needless to say, the documentation and installation MSI for PHP is totally fubar.

I finally settled on the FastCGI installer, and was able to get a test PHP page working.  The main WordPress page would load up, but any inner pages would produce an “internal server error”.  I messed with PHP lots more,but finally found the issue (after about 5 hours of troubleshooting).

The issue was the WordPress theme I was using.  More specifically… the comments snippet wasn’t designed for WP 2.7.  Using another theme works just fine.  I did more reading, and apparently there are some inconsistencies when using the ISAPI instead of CGI.

So, it was a long haul, but I finally have WordPress running with gZip AND Output caching at the same time — something that even WP-super-cache won’t do.  I even have URL rewrites working.  Now all the features people really needed in Apache for is now in IIS 7.

Serving a WordPress page is now many multitudes of times faster, and can certainly handle high traffic from a slashdot or Digg…

I’ll still do some more testing, but it looks like I finally have a stable WordPress platform with no compromise on features.

Alan is a web architect, stand-up comedian, and your friendly neighborhood Grammar Nazi. You can stalk him on the Interwebs via Google+, Facebook and follow his ass on Twitter @ocmodshop.