WordPress “CGI Error” Fix

Software

  • WordPress 2.3.3  

Server Environment (shared)

  • Windows 2003 Server
  • IIS 6
  • PHP 5.2.5 (CGI/FastCGI)
  • MySQL
  • Provider: Crystaltech.com

Problem Description

  • The following CGI error appears after enabling “Date and name based” permalink structure:

CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers.

Solution

Assuming that you do not want to change back to default permalink structure and loose your pretty URLs try the following fixes

  1. Log Permissions Fix:
    1. Open file /wp-includes/wp-db.php in your favourite edito
    2. Around line 163 find the following code:
      error_log($error_str, 0)
    3. Replace it with following code:
      // begin GamaFX.com CGI ERROR Fix
        //ORIGINAL CODE: error_log($error_str, 0);
      // end GamaFX.com CGI ERROR Fix
    4. Upload the file and retest the website.  If the problem presists, proceed to the next fix
  2. DB File Replacement Method
    1. Replace the entire content of /wp-includes/wp-db.php with the code contained in this wp-db.php.txt file
    2. Upload the file and retest the website.  If the problem presists, proceed to the next fix
  3. Plugin Fix
    1. Crystaltech.com IIS custom errors setupRedirect your custom 404 error page to index.php
      If you are hosted with Crystaltech Hosting, please see the screenshot
    2. Download the WordPress – Remove Index.php from Permalinks in IIS Plugin (scroll down), and install it into wordpress (upload to /wp-content/plugins/ folder)
    3. Remove index.php from your custom permalink structure by going to Options > Permalinks
    4. Activate the “Remove Index.php” plugin from WordPress control panel Plugins page.