Re: Bug 5181: No input file specified' error in CGI mode / location of bugs in code

From: Date: Thu, 03 Aug 2000 16:14:21 +0000
Subject: Re: Bug 5181: No input file specified' error in CGI mode / location of bugs in code
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-27566@lists.php.net to get a copy of this message
Hi, The changes I listed in my original description were more extensive than needed; I didn't quite understand the problem at the time. The big problem for us was that we -aren't- using an Apache server -- we are using a heavily-customized NCSA server, and they didn't set SCRIPT_FILENAME, only SCRIPT_NAME. So the only change I had to implement in sapi/cgi/cgi_main.c was some logic that would use argv0 if SCRIPT_FILENAME wasn't set: row 629: if (getenv("SCRIPT_FILENAME")) SG(request_info).path_translated = estrdup(getenv("SCRIPT_FILENAME")); else /* CNC Web server doesn't use SCRIPT_FILENAME, so... */ { SG(request_info).path_translated = estrdup(SG(request_info).argv0); } That seems to do the trick for us. - Patrick Doyle Yury Bokhoncovich wrote: > > Hi! > > I think the problem is lying elsewhere than it was described. > Look, this is typical CGI call for Apache 1.2 and 1.3 (essentially, > irrelevant stuff snipped): > > SERVER_SOFTWARE = Apache/1.2.5<BR> > GATEWAY_INTERFACE = CGI/1.1<BR> > DOCUMENT_ROOT = /usr/local/www/data<BR> > SERVER_PROTOCOL = HTTP/1.0<BR> > REQUEST_METHOD = GET<BR> > REMOTE_HOST = ic.fis.nsk.su<BR> > QUERY_STRING = <BR> > HTTP_USER_AGENT = Lynx/2.8.2dev.14 libwww-FM/2.14<BR> > .... > SCRIPT_NAME = /cgi-bin/printenv<BR> > SCRIPT_FILENAME = /usr/local/www/cgi-bin/printenv<BR> > .... > REQUEST_URI = /cgi-bin/printenv<BR> > SERVER_PORT = 80<BR> > .... > > There're neither PATH_INFO nor PATH_TRANSLATED although CGI-script is > fully functional. > Walking thru Apache sources shows that those ain't really in use. > Instead, SCRIPT_NAME and SCRIPT_FILENAME are set in every CGI-call. > Maybe Rows 629-633: > #if DISCARD_PATH > SG(request_info).path_translated = > estrdup(getenv("SCRIPT_FILENAME")); > #else > SG(request_info).path_translated = > estrdup(getenv("PATH_TRANSLATED")); > #endif > > should be: > #if DISCARD_PATH > SG(request_info).path_translated = > estrdup(getenv("SCRIPT_FILENAME")); > #else > > > SG(request_info).path_translated=estrdup(strcat(getenv("DOCUMENT_ROOT"),getenv("SCRIPT_NAME"))); > #endif > > And yet, Row 311: > SG(request_info).request_uri = getenv("PATH_INFO"); > Maybe, there should be: > SG(request_info).request_uri = getenv("REQUEST_URI"); > > -- > WBR, Yury Bokhoncovich, > SysAdmin at FIS. > voice call: +7 (3832) 119727 pager: +7 (3832) 186555/61621 > mailto: byg@fis.ru visit us: > http://www.fis.ru/

« previous php.dev (#27566) next »