[wp-trac] [WordPress Trac] #2628: wordpress broken under apache mod_fastcgi with php ran as a cgi

WordPress Trac wp-trac at lists.automattic.com
Sun Apr 2 09:36:38 GMT 2006


#2628: wordpress broken under apache mod_fastcgi with php ran as a cgi
-----------------------+----------------------------------------------------
       Id:  2628       |      Status:  new                     
Component:  General    |    Modified:  Sun Apr  2 09:36:38 2006
 Severity:  normal     |   Milestone:  2.0.2                   
 Priority:  normal     |     Version:  2.0.2                   
    Owner:  anonymous  |    Reporter:  scruby                  
-----------------------+----------------------------------------------------
 The error happens when php is run through fastCGI, and it is related to
 this problem that's reported on php bugs:
 http://bugs.php.net/bug.php?id=36705

 To duplicate the problem, you need to compile php sapi/cli with fastcgi
 support, and run it under apache2/mod_fastcgi.  This is what an entry in
 the error log looks like:

 [Sat Apr 01 23:30:20 2006] [error] [client 66.215.220.80] FastCGI: comm
 with server "/var/www/fcgi-php/php" aborted: error parsing headers:
 duplicate header 'Status'

 The relevant section of code is in wp-includes/functions.php

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

 According to the suggestions on the php bug list, one workaround would be
 to rewrite this section of functions.php as follows:

 if (substr(php_sapi_name(), 0, 3) == 'cgi')
 @header("Status: $header $text");
 else
 @header("HTTP/1.1 $header $text");

 I made this change myself, and it seems to make wordpress work both under
 mod_php and mod_fastcgi.  I'm running apache 2.0.55/php 4.2.2  I've tested
 this code myself in both mod_cgi and mod_fastcgi configurations and it
 seems that all is well with it.  I haven't tested this with php5, apache
 1.3.x, or the extremely new apache versions above 2.0.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/2628>
WordPress Trac <http://wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list