php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #5679 PHP dies when call from Apache/CGI
Submitted: 2000-07-19 20:08 UTC Modified: 2000-10-02 22:48 UTC
From: werner dot stegbauer at de dot abb dot com Assigned:
Status: Closed Package: Reproducible Crash
PHP Version: 4.0.0 OS: NT 4.0
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: werner dot stegbauer at de dot abb dot com
New email:
PHP Version: OS:

 

 [2000-07-19 20:08 UTC] werner dot stegbauer at de dot abb dot 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-07-24 09:40 UTC] werner dot stegbauer at de dot abb dot 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:\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


 [2000-07-25 15:39 UTC] werner dot stegbauer at de dot abb dot 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:\apache\cgi-bin (i.e. your cgi-bin path)
  set PATH_TRANSLATE=od.php3      (i.e. your cgi-bin script)
  c:\primos\php3\php.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-09-04 20:34 UTC] sniper@php.net
Does this problem exist with php4.0.2 ?

--Jani
 [2000-10-02 22:48 UTC] sniper@php.net
No feedback.

--Jani
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Sat Oct 10 06:00:01 2026 UTC