|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2000-06-28 05:06 UTC] stas at cvs dot php dot net
[2000-08-01 22:59 UTC] waldschrott@php.net
[2000-08-02 12:13 UTC] hholzgra@php.net
[2001-01-12 11:18 UTC] sniper@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 21:00:02 2025 UTC |
As others have reported, setting --enable-discard-path does not allow PHP to run properly in CGI mode. This simple script will fail when hit through a Web server: #!/usr/local/bin/php <?php echo "Hello, world."; ?> producing a "No input file specified" error. There seem to be three bugs in the file sapi/cgi/cgi_main.c that cause this. (At least, when I fixed these things, it worked). I'll now reveal what is probably my ignorance of the code by pointing them out. The problems are all in the init_request_info() function. Specifically, 1. ~Line 252. script_filename is set to getenv("SCRIPT_FILENAME") rather than getenv("SCRIPT_NAME"). Maybe SCRIPT_FILENAME is a newer variant I haven't heard of, but our servers have always used SCRIPT_NAME. 2. ~Line 278. If DISCARD_PATH is set and script_filename is available, SG(request_info).path_translated should be set to the concatenation of getenv("DOCUMENT_ROOT") and script_filename, not just script_filename. Otherwise, when php_fopen_primary_script() tries to open it it will bomb, because it doesn't have the full path. 3. ~Line 290. For some reason, irrespective of the previous DISCARD_PATH section, SG(request_info).path_translated is set to NULL. This will clobber the script name when discard path is enabled. As far as I can tell this line should simply be removed. Hope that's useful to someone. :)