«    »

Resolving PHP No Input File Specified Error for WordPress on IIS

My website was recently almost entirely non-functional for several days. I noticed the problem by the sharp drop in my traffic statistics, and a quick check of the site revealed that most of my pages were displaying a PHP message "No input file specified error" rather than the actual content. After a quick flurry of activity on my part I was able to fix the issue, but it required more work than I expected. This article provides the details of my investigation, and more importantly the solution I used to fix the problem.

The Problem

My first step was to determine exactly what was wrong. My home page displayed fine, but all other links to articles, tags, and categories were not working. I then tried URLs corresponding to actual files on the web server, and these resolved fine. My site is powered by WordPress running on a Microsoft IIS web server. The IIS ISAPI_rewrite module is used to rewrite URLs to provide custom SEO-friendly URLs for permanent links (permalinks in WordPress terminology), as described in my article Running WordPress 2.0 under IIS. My problem was that these WordPress permalinks were not working. I confirmed this by going to the Permalink Settings page within my WordPress Site Admin and changing the common settings to default – all pages were now accessible.

This problem happened to me shortly after I upgraded to WordPress 2.8, so I suspected a compatibility issue between WordPress and PHP, although I had no idea why I had not noticed the problem when I initially upgraded. I checked the WordPress installation requirements and confirmed that the version of PHP I was running (v4.4.9) was greater than the minimum requirement of 4.3 or greater.

Solution #1

I then turned to Google to find out if others had experienced this problem and what they had done about it. My search surprisingly turned up mostly unhelpful results, with the exception of one article: CodeIgniter - No input file specified error - .htaccess - PHP5 - Apache 2. This lifesaver article provided the first solution that truly worked. While this article provides two separate solutions and states that only one of the two needs to be used, I found I had to use both. The changes I had to make were:

  1. Modify my PHP settings (in php.ini) to set cgi.fix_pathinfo = 0.
  2. Change my URL rewriting (in httpd.ini) to rewrite custom URLs into URLs starting with "index.php?" instead of just "index.php" – i.e. add a question mark '?' to the end of "index.php". The revised rewrite rule is: RewriteRule /psd/(.*) /psd/index.php?/$1 [L,U].

I experienced difficulties testing this solution – it appeared as though the web server was caching the PHP or rewrite settings and not immediately applying my changes. This may have been why I never noticed the problem immediately after upgrading to WordPress 2.8.

Solution #2

Once I determined the problem was related to PHP, I decided to upgrade to PHP version 5 rather than PHP version 4. I requested the upgrade while I resolved the problem using the above solution. Once the upgrade to PHP version 5 was completed, I reverted my URL rewriting change and found that the problem did not reoccur. So I now strongly recommend only running WordPress 2.8 under IIS using PHP version 5.

If you find this article helpful, please make a donation.

One Comment on “Resolving PHP No Input File Specified Error for WordPress on IIS”

  1. Luke says:

    I just wanted to say thank you for the Solution #1 which worked for me. Interestingly, I experience this problem on PHP 5.2 but not on PHP 5.3.

«    »