May 31

Wordpress Permalinks do not work with PHP 5.2.1 and IIS

We recently upgraded our servers at NFi from PHP 5.1.2 to PHP 5.2.2. We needed to upgrade to fix a bug in PHP’s COM object support. PHP 5.2.2 and PHP 5.2.1 have proven to be buggy on windows and broken things that have previously worked. Upgrading to 5.2.2 introduces a bug in the mysql module that keeps outputting the following at the end of every script:

Error in my_thread_global_end(): 3 threads didn’t exit

Wordpress is based upon MySQL so this obviously won’t work even though the error is present even when non MySQL code is being run. Downgrading to PHP 5.2.1 fixes that problem. You are not in the clear yet though. With PHP 5.2.1 there is a problem with the standard method Wordpress uses for permalinks.


The default method for using permalinks with Wordpress is to use the following URL style:

/index.php/2007/05/31/sample-post/

This will not work with PHP 5.2.1 though. It appears that it treats that location as the full path to the file to serve. It looks for the folder index.php instead of running the actual script. Since the folder doesn’t exist you get a 404 File Not Found Error.

Moving down yet again to PHP 5.2.0 will fix the problem and that is what I am now running with this blog. Alternatively you can use ISAPI Rewrite for WordPress which will rewrite your URL’s to not use the standard style. There is another popular Wordpress Permalink ISAPI Filter though that still relies upon the /index.php/%year%/%monthnum%/%day%/%postname%/ style. If you are using this filter you will need to use PHP 5.2.0.