DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=30673>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=30673 Apache Redirects to CGI in 404 Case Summary: Apache Redirects to CGI in 404 Case Product: Apache httpd-1.3 Version: 1.3.31 Platform: PC OS/Version: Windows XP Status: NEW Severity: Major Priority: Other Component: Other mods AssignedTo: [email protected] ReportedBy: [EMAIL PROTECTED] When configuring PHP 4.3.x as a CGI using the ScriptAlias, AddType, Action method, I discovered a bug in Apache 1.3.31 that appears to have emerged since Apache 1.3.27 (the last version deployed on my site). In the 404 case (e.g, http://www.example.com/should_cause_a_404.php), Apache does *not* trigger a 404. Instead, the request is incorrectly aborted with a 500 (Internal Server Error). Checking the error log reveals a "Premature end of script headers" error. I've confirmed that my ErrorDocuments are correct, as static 4xx codes work correctly (the ErrorDocuments are Apache default). Setting the error log LogLevel to 'debug' reveals that Apache is invoking PHP with PATH_INFO set to the URI of the script. Each request generates debug activity similar to the following: [Sat Aug 14 19:09:28 2004] [info] Invoking CGI Command 'c:\\php\\php.exe ' [Sat Aug 14 19:09:28 2004] [debug] .\main\util_script.c(1101): CGI env[0] = 'COMSPEC=C:\\WINDOWS\\system32\\cmd.exe' [Sat Aug 14 19:09:28 2004] [debug] .\main\util_script.c(1101): CGI env[1] = 'DOCUMENT_ROOT=c:/foxserv/www' [Sat Aug 14 19:09:28 2004] [debug] .\main\util_script.c(1101): CGI env[2] = 'HTTP_ACCEPT=text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1' [Sat Aug 14 19:09:28 2004] [debug] .\main\util_script.c(1101): CGI env[3] = 'HTTP_ACCEPT_CHARSET=ISO-8859-1,utf-8;q=0.7,*;q=0.7' [Sat Aug 14 19:09:28 2004] [debug] .\main\util_script.c(1101): CGI env[4] = 'HTTP_ACCEPT_ENCODING=gzip,deflate' [Sat Aug 14 19:09:28 2004] [debug] .\main\util_script.c(1101): CGI env[5] = 'HTTP_ACCEPT_LANGUAGE=en-us,en;q=0.5' [Sat Aug 14 19:09:28 2004] [debug] .\main\util_script.c(1101): CGI env[6] = 'HTTP_CONNECTION=keep-alive' [Sat Aug 14 19:09:28 2004] [debug] .\main\util_script.c(1101): CGI env[7] = 'HTTP_HOST=localhost' [Sat Aug 14 19:09:28 2004] [debug] .\main\util_script.c(1101): CGI env[8] = 'HTTP_KEEP_ALIVE=300' [Sat Aug 14 19:09:28 2004] [debug] .\main\util_script.c(1101): CGI env[9] = 'HTTP_REFERER=http://localhost/' [Sat Aug 14 19:09:28 2004] [debug] .\main\util_script.c(1101): CGI env[10] = 'HTTP_USER_AGENT=Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)' [Sat Aug 14 19:09:28 2004] [debug] .\main\util_script.c(1101): CGI env[11] = 'PATH=C:\\Perl56\\bin\\;C:\\WINDOWS\\system32;C:\\GPG;C:\\Perl\\bin\\;C:\\WINDOWS;C:\\WINDOWS\\COMMAND;C:\\PROGRA~1\\MICROS~5\\VC98\\INCLUDE;C:\\PROGRA~1\\RATIONAL\\COMMON;C:\\EXPLORER.4L;C:\\PHP;C:\\HTTPD\\PHP;"C:\\Program Files\\PKWARE\\PKZIPC\\";C:\\PROGRA~1\\SSHCOM~1\\SSHSEC~1;C:\\WINDOWS\\system32\\WBEM;C:\\Program Files\\cvsnt;C:\\PROGRA~1\\Gupta' [Sat Aug 14 19:09:28 2004] [debug] .\main\util_script.c(1101): CGI env[12] = 'REDIRECT_STATUS=200' [Sat Aug 14 19:09:28 2004] [debug] .\main\util_script.c(1101): CGI env[13] = 'REDIRECT_URL=/index2.php' [Sat Aug 14 19:09:28 2004] [debug] .\main\util_script.c(1101): CGI env[14] = 'REMOTE_ADDR=127.0.0.1' [Sat Aug 14 19:09:28 2004] [debug] .\main\util_script.c(1101): CGI env[15] = 'REMOTE_PORT=4336' [Sat Aug 14 19:09:28 2004] [debug] .\main\util_script.c(1101): CGI env[16] = 'SCRIPT_FILENAME=c:/php/php.exe' [Sat Aug 14 19:09:28 2004] [debug] .\main\util_script.c(1101): CGI env[17] = 'SERVER_ADDR=127.0.0.1' [Sat Aug 14 19:09:28 2004] [debug] .\main\util_script.c(1101): CGI env[18] = '[EMAIL PROTECTED]' [Sat Aug 14 19:09:28 2004] [debug] .\main\util_script.c(1101): CGI env[19] = 'SERVER_NAME=techie.hopto.org' [Sat Aug 14 19:09:28 2004] [debug] .\main\util_script.c(1101): CGI env[20] = 'SERVER_PORT=80' [Sat Aug 14 19:09:28 2004] [debug] .\main\util_script.c(1101): CGI env[21] = 'SERVER_SIGNATURE=<ADDRESS>Apache/1.3.31 Server at techie.hopto.org Port 80</ADDRESS>\n' [Sat Aug 14 19:09:28 2004] [debug] .\main\util_script.c(1101): CGI env[22] = 'SERVER_SOFTWARE=Apache/1.3.31 (Win32) mod_gzip/1.3.26.1a' [Sat Aug 14 19:09:28 2004] [debug] .\main\util_script.c(1101): CGI env[23] = 'SystemRoot=C:\\WINDOWS' [Sat Aug 14 19:09:28 2004] [debug] .\main\util_script.c(1101): CGI env[24] = 'WINDIR=C:\\WINDOWS' [Sat Aug 14 19:09:28 2004] [debug] .\main\util_script.c(1101): CGI env[25] = 'GATEWAY_INTERFACE=CGI/1.1' [Sat Aug 14 19:09:28 2004] [debug] .\main\util_script.c(1101): CGI env[26] = 'SERVER_PROTOCOL=HTTP/1.1' [Sat Aug 14 19:09:28 2004] [debug] .\main\util_script.c(1101): CGI env[27] = 'REQUEST_METHOD=GET' [Sat Aug 14 19:09:28 2004] [debug] .\main\util_script.c(1101): CGI env[28] = 'QUERY_STRING=' [Sat Aug 14 19:09:28 2004] [debug] .\main\util_script.c(1101): CGI env[29] = 'REQUEST_URI=/index2.php' [Sat Aug 14 19:09:28 2004] [debug] .\main\util_script.c(1101): CGI env[30] = 'SCRIPT_NAME=/php/php.exe' [Sat Aug 14 19:09:28 2004] [debug] .\main\util_script.c(1101): CGI env[31] = 'PATH_INFO=/index2.php' [Sat Aug 14 19:09:28 2004] [debug] .\main\util_script.c(1101): CGI env[32] = 'PATH_TRANSLATED=c:\\foxserv\\www\\index2.php' The only problem is that the file listed *does not* exist, and never has. In PATH_TRANSLATED is the path to a non-existant file. Handling of this should revert to the previous behavior of returning the (accurate) 404 status code, rather than a Server Error (500). --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
