Support » Requests and Feedback » problems running under php/fastcgi

  • scruby


    FastCGI is very picky about there being only one “Status” header being sent from apps. So, if like me you are running wordpress under php/fastcgi, you get errors like this:

    [Sat Apr 01 23:30:42 2006] [error] [client] FastCGI: comm with server “/var/www/fcgi-php/php” aborted: error parsing headers: duplicate header ‘Status’

    This behavior is discussed on php bugs:

    According to php bugs, the resolution to this problem is at the programming level.

    In wordpress, in file /wp-includes/functions.php there is the following two lines of code:

    @header(“Status: $header $text”);
    @header(“HTTP/1.1 $header $text”);

    In order to make wordpress play nicely with fastcgi, I had to replace those two lines with the following four lines:

    if (substr(php_sapi_name(), 0, 3) == ‘cgi’)
    @header(“Status: $header $text”);
    @header(“HTTP/1.1 $header $text”);

    I’m hoping that the wordpress developers will incorporate this change into the next update of wordpress.

Viewing 3 replies - 16 through 18 (of 18 total)
  • Excuse me for replying to myself…

    I also found I had to put the 404 page into the root folder of wordpress, which is why I was getting error messages on the 404.php

    To get my 404.php to work, I had to remove all instances of <?php bloginfo('name'); ?> and <?php _e('search '); ?> because of course, those functions will only work if the php page is in the theme folder…

    I have now switched to using 404.php

    However, because of the addition to the .htaccess file, I cannot use the following

    The page you were looking for at <strong>http://<?php echo $HTTP_HOST.$REQUEST_URI; ?></strong> does not exist on this site. Please check for typo(s)

    because it merely shows that ../404.php has been requested….

    Anyone know how I can get the 404 page to work correctly?
    (I’m running WordPress 2.0.7)

    Please excuse me for replying to myself one last time… I was looking around in this forum and found the answer here:

    which pointed me to
    WordPress codex: Creating_an_Error_404_Page

    Using the instructions on that page, I put
    <?php header("HTTP/1.1 404 Not Found"); ?>
    at the top of my 404.php and the following in the body of 404.php:

    Whatever it is you were looking for at
    <strong>http://mydomainname<?php echo $_SERVER['REQUEST_URI']; ?></strong>
    does not exist here.
    Please check for typo(s) and/or use the search engine located on this page

    and then uploaded the 404 file in my theme folder.

    I then added the following to the .htaccess file that is in the blog root folder:

    ErrorDocument 404 /wordpress/index.php?error=404

    The 404 is now working as I had hoped and I believe this issue can be marked resolved.

    Also read

    FastCGI on DreamHost

    And dont ever pass a full url to ErrorDocument 404 because it will lose all the REDIRECT variables in apache.

Viewing 3 replies - 16 through 18 (of 18 total)
  • The topic ‘problems running under php/fastcgi’ is closed to new replies.