Bug #28227 [Com]: PHP CGI depends upon non-standard SCRIPT_FILENAME

From: Date: Fri, 12 Sep 2014 11:57:01 +0000
Subject: Bug #28227 [Com]: PHP CGI depends upon non-standard SCRIPT_FILENAME
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-187525@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=28227&edit=1 ID: 28227 Comment by: xsrm0j4w8778b7t at jetable dot org Reported by: lukem at NetBSD dot org Summary: PHP CGI depends upon non-standard SCRIPT_FILENAME Status: No Feedback Type: Bug Package: CGI/CLI related Operating System: * PHP Version: 5CVS, 4CVS (2005-02-04) Assigned To: fmk Block user comment: N Private report: N New Comment: What if one uses, say php-fpm: how can the absolute path of the script.php be determined? I suppose fpm needs that information to be able to launch the script. I see no way of doing that in a fool-proof manner, based on the CGI 1.1 RFC. Even looking at the current directory is not garanteed to work. RFC says: "The current working directory for the script SHOULD be set to the directory containing the script." Is this the reason why SCRIPT_FILENAME is used? Previous Comments: ------------------------------------------------------------------------ [2008-12-30 05:47:14] serge at localhost dot localdomain The bug is still somewhere there. $ php-cgi --version PHP 5.2.6 (cgi-fcgi) (built: May 8 2008 08:52:59) Until it gets fixed in either php-cgi or webservers-side here's a workaround-wrapper: http://pastebin.ca/1296199 I wrote and tested this wrapper for thttpd only. -- Serge ------------------------------------------------------------------------ [2007-12-27 01:16:07] al dot rivero at gmail dot com with PHP/5.2.3-1ubuntu6.2 php-cgi ejemplo.php works, but REQUEST_METHOD=GET php-cgi ejemplo.php doesn't work, it produces the bug, "No input file specified". Then REQUEST_METHOD=GET SCRIPT_FILENAME=ejemplo.php php-cgi ejemplo.php works, and more suprisingly SCRIPT_FILENAME=ejemplo.php php-cgi ejemplo.php works, and SCRIPT_FILENAME=ejemplo.php php-cgi works! Note that there is now an informative-doc RFC for CGI 1.1 http://www.ietf.org/rfc/rfc3875 and it says that _name is a MUST, but _filename is optional, in fact it is not mentioned there (it is an Apache extension). ------------------------------------------------------------------------ [2007-07-03 01:00:01] php-bugs at lists dot php dot net No feedback was provided for this bug for over a week, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open". ------------------------------------------------------------------------ [2007-06-25 23:44:14] sniper@php.net Please try using this CVS snapshot: http://snaps.php.net/php5.2-latest.tar.gz For Windows (zip): http://snaps.php.net/win32/php5.2-win32-latest.zip For Windows (installer): http://snaps.php.net/win32/php5.2-win32-installer-latest.msi ------------------------------------------------------------------------ [2006-08-10 19:05:01] fmk@php.net The patch broke CGI on other web servers (IIS on Win32). That was the reason it was reverted. So far I have not been able to come up with a way to apply your patch so it will work in all cases (not breaking existing installed systems). ------------------------------------------------------------------------ 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 https://bugs.php.net/bug.php?id=28227 -- Edit this bug report at https://bugs.php.net/bug.php?id=28227&edit=1

« previous php.bugs (#187525) next »