|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #7722 script filename not passed to .cgi
Submitted: 2000-11-09 08:38 UTC Modified: 2000-11-09 17:41 UTC
From: tictactux at surfeu dot ch Assigned:
Status: Closed Package: Other web server
PHP Version: 4.0.3pl1 OS: NT4 / Linux 2.2.17
Private report: No CVE-ID: None
 [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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2000-11-09 17:40 UTC] tictactux at surfeu dot ch
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    

 [2000-11-09 17:41 UTC] tictactux at surfeu dot ch
Issue closed, I said...
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jul 13 17:01:30 2024 UTC