Bug #13316 Updated: CGI dies (Premature end of script headers) with URLs with /x after script name

From: Date: Tue, 16 Jul 2002 02:12:11 +0000
Subject: Bug #13316 Updated: CGI dies (Premature end of script headers) with URLs with /x after script name
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-14267@lists.php.net to get a copy of this message
ID: 13316 Updated by: phpbugs@mattholland.com Reported By: jobarr@herzeleid.com Status: Bogus Bug Type: URL related Operating System: Windows 2000 SP1 PHP Version: 4.0.6 New Comment: You can call it "bogus" all you want, but 1) this behavior *DOES* happen, and 2) it *IS NOT* any sort of "limitation of CGI". If you don't understand what's happening, just say so. $PATH_INFO is definitely part of the cgi spec, of course. And it is definitely properly passed through to a cgi script written in Perl. If you write a three line script (call it, say, pathinfo.pl) which merely echoes back the value of $PATH_INFO, then access it with a url like http://myserver/cgi-bin/pathinfo.pl/some/more/stuff , it will dutifully report that $PATH_INFO contains "/some/more/stuff" . Try the same exact thing in PHP running as a cgi engine, you get a 500 error. At least under Linux. How come? phpbugs@mattholland.com Previous Comments: ------------------------------------------------------------------------ [2002-01-27 00:58:44] sterling@php.net This is a limitation of CGI, plain and simple. ------------------------------------------------------------------------ [2001-10-15 19:59:57] edink@php.net If you install PHP as CGI under apache you would typically put: Action php-script /cgi-bin/php AddHandler php-script .php in httpd.conf. If I put: Action printenv-cgi-script /cgi-bin/printenv.pl AddHandler printenv-cgi-script .pe I get the following for request: http://host/test.pe/test PATH_INFO="/test.pe/test" PATH_TRANSLATED="/home/ek/projects/test.pe/test" REQUEST_URI="/test.pe/test" SCRIPT_FILENAME="/home/ek/projects/apache/cgi-bin/printenv.pl" SCRIPT_NAME="/cgi-bin/printenv.pl" How am I supposed to guess that I should open /home/ek/projects/test.pe for processing? ------------------------------------------------------------------------ [2001-10-15 19:42:26] jobarr@herzeleid.com How is that a limitation of the CGI protocol? It works with Perl as a cgi: http://localhost/cgi-bin/printenv.pl/1 Or is that some how different because it is within the cg-bin directory? Perl is being run as a cgi, not a module. These are outputted from printenv.pl: PATH_INFO="/1" PATH_TRANSLATED="c:\www\1" REQUEST_URI="/cgi-bin/printenv.pl/1" SCRIPT_FILENAME="c:/www/cgi-bin/printenv.pl" SCRIPT_NAME="/cgi-bin/printenv.pl" ------------------------------------------------------------------------ [2001-10-15 17:42:31] edink@php.net It is not possible to handle such requests due to the limitiations of CGI protocol. PHP will not crash, it will just output: Fatal error - Unable to open /site/root/script.php/1 which is not valid response and thus the error message. It's probably better that way than to reveal the full path of the script in question. If you really want that functionality install PHP as web server module. ------------------------------------------------------------------------ [2001-09-17 09:34:59] ahill@php.net I can conform this also occurs on linux 2.2.19. Best regards, Andrew ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/13316 -- Edit this bug report at http://bugs.php.net/?id=13316&edit=1

« previous php.bugs (#14267) next »