Error in CGI interface in php4 for Windows

From: Date: Thu, 02 Nov 2000 08:21:00 +0000
Subject: Error in CGI interface in php4 for Windows
Groups: php.dev 
Request: Send a blank email to php-dev+get-36750@lists.php.net to get a copy of this message
Hi everybody, i post this mail on your list, because Andi Gutmans<andi@zend.com> told me to. It's a discusion about what i believe is a fatal error in the CGI interface to PHP4. This is only for the Windows version of PHP4. It's properly a little hard to read by now, because of all the replays between Andi and myself. What is it about ? It's about telling PHP4 for Windows in the CGI-Mode what script to execute. And i believe the PATH_TRANSLATED environment variable is absolutly wrong. The best would be, if you read the discusion from the bottom up. It whould be nice if of one of you gays could drop me a note, on what is right and what is wrong. Sorry about my bad english, but i come from germany. Thomas Thomas Hauck<T.Hauck@t-online.de> ----- Original Message ----- Andi wrote: Best you post this for discussion to php-dev@. I am not quite sure what behavior you want changed. We are using doc_root concatenated with PATH_INFO if doc_root is defined in your INI instead of PATH_TRANSLATED. Andi --- Andi Gutmans <andi@zend.com> http://www.zend.com/ ----- Original Message ----- At 11:36 PM 11/1/00 +0100, Thomas Hauck wrote: Hallo, its me again. In the documentation you told me (http://web.golux.com/coar/cgi/draft-coar-cgi-v11-03-clean.html#6.1.7?) it says in the PATH_TRANSLATED section followering: "If the request URI includes no path-info component, the PATH_TRANSLATED metavariable SHOULD NOT be defined." I understand it this way: If no path-info is in the URI the PATH_TRANSLATED environment variable SHOULD NOT be defined for the cgi-interface,not even set as environment variable. Do you agree with me there ? (If not, i have to go back to english class) Ok it hangs on the PATH_INFO. For a request like this http://www.somewhere.com/scripts/myscript.php we do not have any PATH_INFO, so PATH_TRANSLATED should not be set, as defined above. (PHP will not work, because PATH_TRANSLATED is not set) Now we include some path-info to your URI, than it looks like this: http://www.somewhere.com/scripts/myscript.php/extra-path/info (is the same script as above) but with the adding /extra-path/info Now for our example asume the document root for the webserver is C:\www\html\root (Windows directory) that makes our php-script reside in C:\www\html\root\scripts\myscript.php the PATH_INFO environment variable contains /extra-path/info and the PATH_TRANSLATED environment variable points to C:\www\html\root\extra-path\info witch is a path and not a scriptname, and not even the path where our php script is located. To witch address i should post the emails too ? Regards T.Hauck Telefon : 07041/860686 ab 18.00 Uhr Email: T.Hauck@jana-server.ocm.de T.Hauck@t-online.de Web: http://www.jana-server.ocm.de/ http://home.t-online.de/home/T.Hauck/ ----- Original Message ----- From: "Andi Gutmans" <andi@zend.com> To: "Thomas Hauck" <T.Hauck@t-online.de> Sent: Wednesday, November 01, 2000 9:07 PM Subject: Re: [PHP-DEV] Re: PHP 4.0 Bug #6093 Updated: Fatal error: Unable to open D:\Jana\html in Unknown on line 0 Best if such Emails also go to php-dev@. I found the CGI documentation and it talks about PATH_TRANSLATED (full path name) and SCRIPT_NAME which seems to be some complement to PATH_INFO. I think DISCARD_PATH is compile time because it should not be overloadable by php.ini files due to security reasons. I'm not 100% sure though. Did you see http://web.golux.com/coar/cgi/draft-coar-cgi-v11-03-clean.html#6.1.7? Andi --- Andi Gutmans <andi@zend.com> http://www.zend.com/ ----- Original Message ----- At 08:10 PM 11/1/00 +0100, Thomas Hauck wrote: Hallo, i don't think there is a RFC for the CGI interface. But what i think is a good reference, is the description at http://hoohoo.ncsa.uiuc.edu/cgi/ I'am not an expert on Unix or Linux, but for the Windows-part i think a good solution would be to evaluate the argv[] for the scriptname. I think Perl does it this way to, and Perl is also running on all webservers. In addition to it, the SCRIPT_FILENAME environment variable makes sence too. But to use PATH_TRANSLATED for the scriptname is as far as the documentation at http://hoohoo.ncsa.uiuc.edu/cgi/ goes wrong. I copied you the relevant part's of this documentation below. As far as the #define DISCARD_PATH goes, i think, that a lot of users are not able to compile PHP for them self, because they don't have Visual C++, so they must use what they can donwload from your webside. Why you don't make an entry in the php.ini file to switch this option. A other way would be to evaluating the SERVER_SOFTWARE environment variable, and go with the PATH_TRANSLATED for the servers how do it wrong like apache for NT, and do it the right way for all others. Most of the users of my server-software are unexpierient homeusers, or small companys who build up a little intranetwork, and getting in to php and perl. A lot of this kind of users is apache much to complicated to set up, and IIS runs only on NT. DOCUMENTIONEN FROM http://hoohoo.ncsa.uiuc.edu/cgi/ a.. PATH_INFO CGI allows for extra information to be embedded in the URL for your >gateway which can be used to transmit extra context-specific information to the scripts. This information is usually made available as "extra" information after the path of your gateway in the URL. This information is not encoded by the server in any way. The most useful example of PATH_INFO is transmitting file locations to the CGI program. To illustrate this, let's say I have a CGI program on my server called /cgi-bin/foobar that can process files residing in the DocumentRoot of the server. I need to be able to tell foobar which file to process. By including extra path information to the end of the URL, foobar will know the location of the document relative to the DocumentRoot via the PATH_INFO environment variable, or the actual path to the document via the PATH_TRANSLATED environment variable which the server generates for you. a.. PATH_INFO The extra path information, as given by the client. In other words, scripts can be accessed by their virtual pathname, followed by extra information at the end of this path. The extra information is sent as PATH_INFO. This information should be decoded by the server if it comes from a URL before it is passed to the CGI script. a.. PATH_TRANSLATED The server provides a translated version of PATH_INFO, which takes the path and does any virtual-to-physical mapping to it. Mfg. T.Hauck Telefon : 07041/860686 ab 18.00 Uhr Email: T.Hauck@jana-server.ocm.de T.Hauck@t-online.de Web: http://www.jana-server.ocm.de/ http://home.t-online.de/home/T.Hauck/ ----- Original Message ----- From: "Andi Gutmans" <andi@zend.com> To: "Thomas Hauck" <T.Hauck@t-online.de>; "Bug Database" <php-dev@lists.php.net> Sent: Wednesday, November 01, 2000 5:39 PM Subject: Re: [PHP-DEV] Re: PHP 4.0 Bug #6093 Updated: Fatal error: Unable to open D:\Jana\html in Unknown on line 0 There have always been complaints on this issue because it seems like every web server likes to do it differently. Can you point us to the RFC where it says what variable should be used? Right now when we have DISCARD_PATH enabled we are using SCRIPT_FILENAME and when we don't we are using PATH_TRANSLATED. I am not sure if this logic is correct but it seems to work on >Apache/UNIX and Apache/Windows, and IIS/Windows. Andi --- Andi Gutmans <andi@zend.com> http://www.zend.com/ ----- Original Message ----- At 03:28 PM 11/1/00 +0100, Thomas Hauck wrote: Hallo, i solved the Problem. I downloaded the source-code of php4 and after looking for a few minutes i found the error. You gays should somewhere tell the other people that php4 has a build in error, and whants the scriptname as PATH_TRANSLATED to execute it. At least that is what the comment in the source of php4 says. As far as i know, is this because the apache server software for NT has this error. That means all other Serversoftware has to build in the same error for the PATH_TRANSLATED variable. Whould it not be better to ask for the server-software environment variable and go the standard way if it is not apache for NT. As far as i know, is the PATH_TRANSLATED environment variable the physical translation of the PATH_INFO environment variable, and not the script filename. Sorry about my bad english. Mfg. T.Hauck Telefon : 07041/860686 ab 18.00 Uhr Email: T.Hauck@jana-server.ocm.de T.Hauck@t-online.de Web: http://www.jana-server.ocm.de/ http://home.t-online.de/home/T.Hauck/ ----- Original Message ----- From: "Bug Database" <php-dev@lists.php.net> To: <T.Hauck@t-online.de> Sent: Wednesday, November 01, 2000 3:05 PM Subject: PHP 4.0 Bug #6093 Updated: Fatal error: Unable to open D:\Jana\html in Unknown on line 0 ID: 6093 Updated by: sniper Reported By: T.Hauck@t-online.de Status: Feedback Bug Type: *General Issues Assigned To: Comments: Have you tried using PHP4.0.3pl1 ? Does the problem still exist? --Jani Previous Comments: --------------------------------------------------------------------------- [2000-08-10 23:09:01] T.Hauck@t-online.de Hallo, i'am writting a Http-Server for Windows. I prev. used PHP 3.0.16 and it worked fine. No i installed a PHP 4.0.1pl2 and i will get on the same scripts this message: Fatal error: Unable to open D:Janahtml in Unknown on line 0 where D:Janahtml ist the root directory of the scripts. I tracked it so far down, that if i do not set a few specific eniroment varibals, it works. I include a list with all the enviroment variables the http-server sends. If i leave the ones marked with a * away it works ! COMPUTERNAME=THOMAS COMSPEC=C:WINNTsystem32cmd.exe DOCUMENT_ROOT=D:Janahtml *GATEWAY_INTERFACE=CGI/1.1 HOME=D:Janahtml HOMEDRIVE=C: HOMEPATH= HTTP_ACCEPT=image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/msword, application/vnd.ms-powerpoint, */* HTTP_ACCEPT_ENCODING= HTTP_ACCEPT_LANGUAGE=de HTTP_COOKIE=last_loginid=Thomas HTTP_HOST=thomas HTTP_REFERER= HTTP_USER_AGENT=Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt) INCLUDE=D:ProgrammeMS-StudioVC98atlinclude;D:ProgrammeMS-StudioVC98mfcinclude;D:ProgrammeMS-StudioVC98include;d:CenturaCAPI LIB=D:ProgrammeMS-StudioVC98mfclib;D:ProgrammeMS-StudioVC98lib;d:CenturaCAPI LOGONSERVER=\THOMAS MSDEVDIR=D:ProgrammeMS-StudioCommonMSDev98 NUMBER_OF_PROCESSORS=1 OS2LIBPATH=C:WINNTsystem32os2dll; OS=Windows_NT PATH=C:Perlbin;C:WINNTsystem32;C:WINNT;D:Centura;D:ProgrammeSymantecpcAnywhere;C:Phpbin;D:ProgrammeMS-StudioCommonToolsWinNT;D:ProgrammeMS-StudioCommonMSDev98Bin;D:ProgrammeMS-StudioCommonTools;D:ProgrammeMS-StudioVC98bin PATH_INFO= PATH_TRANSLATED=D:Janahtml PROCESSOR_ARCHITECTURE=x86 PROCESSOR_IDENTIFIER=x86 Family 6 Model 7 Stepping 3, GenuineIntel PROCESSOR_LEVEL=6 PROCESSOR_REVISION=0703 QUERY_STRING= REMOTE_ADDR=190.111.111.77 REMOTE_HOST=190.111.111.77 REMOTE_PORT=2629 *REQUEST_METHOD=GET REQUEST_URI=/env.pl SCRIPT_NAME=/env.pl SERVER_ADDR=190.111.111.77 SERVER_ADMIN=T.Hauck@t-online.de *SERVER_NAME=thomas SERVER_PORT=80 SERVER_PROTOCOL=HTTP/1.1 *SERVER_SOFTWARE=Jana-Server/2.0 SYSTEMDRIVE=C: SYSTEMROOT=C:WINNT TEMP=C:TEMP TMP=C:TEMP USERDOMAIN=THOMAS USERNAME=Thomas USERPROFILE=C:WINNTProfilesThomas WINDIR=C:WINNT (generatet with a perl-script, because php does't work) There must be some reason for that message with the enviroment variables. By the way the php.ini file i left unchanged and copyed it to the Windowsdirectory. It would be greate to here from you soon. What i'am doing wrong. Thanks Thomas Hauck, Germany Http://www.jana-server.ocm.de/ Mail:T.Hauck@t-online.de --------------------------------------------------------------------------- Full Bug description available at: http://bugs.php.net/?id=6093 -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net For additional commands, e-mail: php-dev-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.dev (#36750) next »