PHP 4.0 Bug #5679 Updated: PHP dies when call from Apache/CGI

From: Date: Tue, 05 Sep 2000 00:34:03 +0000
Subject: PHP 4.0 Bug #5679 Updated: PHP dies when call from Apache/CGI
Groups: php.dev 
Request: Send a blank email to php-dev+get-32015@lists.php.net to get a copy of this message
ID: 5679 Updated by: sniper Reported By: werner.stegbauer@de.abb.com Status: Feedback Bug Type: Reproduceable crash Assigned To: Comments: Does this problem exist with php4.0.2 ? --Jani Previous Comments: [2000-07-25 15:39:48] werner.stegbauer@de.abb.com Hi there, me again, some more comments on my problem I have now something like the ultimate solution/workaround to the 'No input file specified' problem! I have done my homework and studied a little bit of PHP3 source code. I found that the environment variables PATH_INFO and PATH_TRANSLATED play an important role when it comes to the above error situation. In addition, I read a little CGI docu and found that Apache does not use these variables. I decided to define these two variables before starting php and it worked out perfectly - on all plattforms and with PHP3 and PHP4. So the wellknown PHP4 bug 'OleMainThreadWndName: .. 0x1007d14e' also dissapeared and PHP4 on NT runs perfectly. I summarize my workaround: 1: Define in an HTML-Form as CGI-ACTION an NT batchfile, say od.bat. 2: od.bat containes these lines: @echo off set PATH_INFO=c:apachecgi-bin (i.e. your cgi-bin path) set PATH_TRANSLATE=od.php3 (i.e. your cgi-bin script) c:primosphp3php.exe (i.e. NO input file) 3: PHP3 comes up nicely and processes od.php3 If you omit the lines 'set PATH_..=' you will see the familar 'No input file specified' from PHP3 and the accessvio from PHP4. On UNIX you write a script and use setenv/export for 'set ..'. That was it, Werner --------------------------------------------------------------------------- [2000-07-24 09:40:03] werner.stegbauer@de.abb.com Hi there, I have some more info to my problem above. I tried php3 instead of php4 in a similar environment as above and I got another reaction: I got an error message 'No input file specified'. I tried thousand things to get rid of this until I did the following: I defined in a DOS Console exactly the same environment variables as those passed to PHP3 when called from my WEB Server (Apache). Et voila: I got 'No input file specified' By reducing all variables I finally found the bad guy: SERVER_NAME. If this one is set, PHP3 does not work anymore. So everybody is welcome to try these steps: 1: Download php3 to any directory 2: cd to this directory and issue php -v. You will get: 3.0.16 3: set variable SERVER_NAME to any value (I used 'lisa', who is my daughter) and issue 'php -v' again and you will see: > set SERVER_NAME=lisa > php -v X-Powered-By: PHP/3.0.16 Content-type: text/html <br> <b>Fatal error</b>: Unable to open -v in <b>-</b> on line <b>0</b><br> No input file specified. So we have reproduced the CGI binary behaviour in a DOS Console. Unfortunately it does not help to unset SERVER_NAME in a Batch CGI script before calling PHP3 - same effect (i.e. 'No input file specified'). Further systematic work along the lines outlined above found finally the bad guy: It is the variable SCRIPT_FILENAME, unsetting this finally made PHP3 as CGI binary work on NT. Summarizing everything, I have now PHP3 as CGI binary on NT with apache working as follows: 1: Define in an HTML-Form as CGI-ACTION an NT batchfile, say od.bat. 2: od.bat containes these lines @echo off set SCRIPT_FILENAME= c:primosphp3php.exe odbc_books.php3 3: PHP3 comes up nicely and processes odbc_books.php3 4: If you omit the line 'set SCRIPT_FILENAME=' you will see the familar 'No input file specified'. Going back to PHP4 with this technique, I was only partially 'successful': Setting up the environment variables in a DOS Console as above will ALSO crash PHP4 (OleMainThreadWndName: .. 0x1007d14e ..), but I did not succeed in unsetting the environment variables in the CGI batch file as above - PHP4 is still crashing. Feedback wellcome, Werner --------------------------------------------------------------------------- [2000-07-19 20:08:33] werner.stegbauer@de.abb.com When I call PHP via an URL "/localhost/cgi-bin/phi.php" it comes up but dies immediately with an displayed NT Error Message Box saying in Title: "OleMainThreadWndName: php.exe" and in the box itself (in german, I translate it here): "The instruction in 0x1007d14e point to 0x00000. The "read" could not be processed" The file phi.php does contain only this: #!php.exe <? print "here is phi<BR>n"; ?> If I call phi.php from command line it works fine. My impression is, that php does not even touch the file phi.php when called via cgi. I have Apache 1.3.11 and PHP 4.0.1pl2. If have the PHP path system wide defined in the PATH variable and also '.php' associated with PHP. And I have edited http.conf as in your documentation outlined (replacing php3 by php). Any Ideas? Thanks a lot --------------------------------------------------------------------------- Full Bug description available at: http://bugs.php.net/?id=5679

« previous php.dev (#32015) next »