[info] mod_rewrite (pretty urls), fastcgi & 500 errors on 404 requests
Posted: Tue Apr 14, 2009 3:40 pm
Throwing this out there in case someone else is using a similar setup and experiencing issues with 500 errors on 404 requests when using mod_rewrite for pretty URLs and a fastcgi based PHP setup. Note that this only happens when the requested url bypasses the .htaccess 404 redirect (due to rewrite rules) and CMSms tries to handle the situation.
An indication that you are having a similar problem is this server error_log output:
FastCGI: comm with server "/path/to/php5/bin/php" aborted: error parsing headers: duplicate header 'Status'
If you don't feel lilke probing around core CMSms files, you can avoid this issue altogether by setting up your CMSms rewrite rules to use a page extension that doesn't exist in your old site. Also, there seems to be hope that this issue is not present in PHP v5.3.
My setup is as follows:
Apache/1.3.41
PHP Version 5.2.6 (CGI/FastCGI )
CMSms 1.5.4
There's two edits needed to avoid to 500 errors, as follows:
lib/content.functions.php - line 673
replace:
with:
lib/misc.functions.php - line 192
replace:
with:
There's plenty of debate if this is a fastcgi, php, or coding issue, so I will not take on that discussion. If you're interested in reading more, Google "FastCGI duplicate header Status" for the debates, issues and/or solutions.
Brian
An indication that you are having a similar problem is this server error_log output:
FastCGI: comm with server "/path/to/php5/bin/php" aborted: error parsing headers: duplicate header 'Status'
If you don't feel lilke probing around core CMSms files, you can avoid this issue altogether by setting up your CMSms rewrite rules to use a page extension that doesn't exist in your old site. Also, there seems to be hope that this issue is not present in PHP v5.3.
My setup is as follows:
Apache/1.3.41
PHP Version 5.2.6 (CGI/FastCGI )
CMSms 1.5.4
There's two edits needed to avoid to 500 errors, as follows:
lib/content.functions.php - line 673
replace:
Code: Select all
header("Status: 404 Not Found");
Code: Select all
if (php_sapi_name() !== 'cgi-fcgi') {
header("Status: 404 Not Found");
}
replace:
Code: Select all
header("Status: 404 Not Found");
Code: Select all
if (php_sapi_name() !== 'cgi-fcgi') {
header("Status: 404 Not Found");
}
Brian