PHP 4.0 Bug #5679 Updated: PHP dies when call from Apache/CGI
| From: | Bug Database | Date: | Mon, 24 Jul 2000 07:40: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-25669@lists.php.net to get a copy of this message | ||
ID: 5679
User Update by: werner.stegbauer@de.abb.com
Status: Open
Bug Type: Reproduceable crash
Description: PHP dies when call from Apache/CGI
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:\primos\php3\php.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
Full Bug description available at: http://bugs.php.net/?id=5679