User Rating: 



/ 0

Since months, now I (understand also YOU) receive some blank page when browsing my Internet homepage.
This strange behavior seems to occur only when having PHP running as FastCGI
FastCGI is a protocol for interfacing interactive programs with a web server. FastCGI is a variation on the earlier Common Gateway Interface (CGI); FastCGI's main aim is to reduce the overhead associated with interfacing the web server and CGI programs, allowing a server to handle more web page requests at once. [WikiPedia]
The Apache logs are quite explicit:
[error] [client x.x.x.x] FastCGI: comm with server "/srv/www/cgi-bin/php5" aborted: error parsing headers: duplicate header 'Status'
The error is located in the file /libraries/joomla/environment/response.php, at the function JResponse::sendHeaders()
The way header has to be send is different when using PHP FastCgi, strange that Joomla! 1.5.9 still do not have this in main stream code...
Old code
function sendHeadersOld()
{
if (!headers_sent())
{
foreach ($GLOBALS['_JRESPONSE']->headers as $header)
{
if ('status' == strtolower($header['name']))
{
// 'status' headers indicate an HTTP status, and need to be handled
// slightly differently
header(ucfirst(strtolower($header['name'])) . ': ' . $header['value'], null,
(int) $header['value']);
} else {
header($header['name'] . ': ' . $header['value']);
}
}
}
}
This is how it should look like, code is backward compatible, if PHP run as an apache module.
function sendHeaders()
{
if (!headers_sent())
{
foreach ($GLOBALS['_JRESPONSE']->headers as $header)
{
if ('status' == strtolower($header['name']))
{
// 'status' headers indicate an HTTP status, and need to be handled
// slightly differently
$attribute = ucfirst(strtolower($header['name'])) . ': ' . $header['value'];
if (substr(php_sapi_name(), 0, 8) == 'cgi-fcgi') {
$attribute = str_replace("Status:", "HTTP/1.1", $attribute);
}
header($attribute, null, (int) $header['value']);
} else {
header($header['name'] . ': ' . $header['value']);
}
}
}
}
Created on Saturday, 21 February 2009 12:45
Last Updated on Friday, 12 August 2011 17:08
Published Date
Hits: 11521