Bug/Fix: RSS feeds on Debian Woody/CGI mode bring error 500
-
Preface: The problem discussed here is about problems with feeds that happen after changing “Last Modified” to “Last-Modified” in wp-blog-headers.php. If you encounter error 500, be sure you have applied that change already before continue reading, because everything will be fine after this in 99% of all cases.
Now on to the topic: If WordPress is run on Debian Woody with PHP 4.1.2 installed and PHP is running in CGI mode, the follwoing problem arieses: Each time an application requires a feed with “Is-Modified-Since” set, a server error occurs (error 500) when indeed status 304 (Not modified) should have been send.
This is especially annoying since all feed readers mark your feed as containing erros most of the time. Doesn’t look professionell ;-).
The reason is, that PHP is not allowed to send headers when running ihn CGI mode. See https://www.srcf.ucam.org/faq/cgi#php-header for details (Thanks to Nathan, the only ressource I could find on the net reagarding that problem).
Well, the solution is to modify wp-blog-header.php around line 101. Instead of “HTTP/1.x 304 Not Modified” send “Status: 304 not modified”. Change your code to look like this, and it works:
if ( preg_match('/cgi/',php_sapi_name()) ) {
header('Status: 304 Not Modified');
echo "\r\n\r\n";
exit;
- The topic ‘Bug/Fix: RSS feeds on Debian Woody/CGI mode bring error 500’ is closed to new replies.