|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2000-11-09 08:38 UTC] tictactux at surfeu dot ch
When using php4.03pl1 as a .cgi (both from source or win32 binaries), the script filename is not passed to php[.exe]. When I set the document root to /usr/local/www, then php complains that it was 'unable to open /usr/local/www in unknown at line 0.' When I set the document root to /usr/local/www/cgi-bin/test.php, then - miracle! - test.php is loaded. (test.php will be loaded regardless of what other script I try to access, as I set the doc_root to /usr/local/www/cgi-bin/test.php...) Same both under Linux and WinNT. Seems that the script name is not appended to doc_root. The SCRIPT_NAME variable is set correctly when I look at the phpinfo() output. I set the display_startup_error to on; else I'd have the 'document contains no data' error. The rest of the .ini (except from the doc_root entry) is as shipped. Same stuff works fine with php 3.0.17. Shouldn't PHP get the contents from the SCRIPT_NAME variable and add/mangle it to the doc_root setting? Regards, Ben PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 01:00:01 2025 UTC |
Okay, got the bugger: in sapi/cgi/cgi_main.c, function init_request_info I added the following lines (marked by >>>) if (!script_filename) { >>> script_filename = getenv("SCRIPT_NAME"); >>> if (!script_filename) script_filename = SG(request_info).argv(); } so that my annoying server who does not ship SCRIPT_FILENAME still stands a valid chance... If you think that the SCRIPT_NAME should be the last resort, then simply swap the assignments in the outer if clause. Issue closed. Unless someone forgets to put that into the source... Regards, Ben