Re: [PHP4BETA] CGI version of PHP not working

[email protected] (Victor) Thu, 08 Jun 2000 12:19:14 -0400
Newsgroups php.version4
Message-ID <[email protected]>
Nope, it didn't work, here is the error I get when I run ./test.cgi from
command line

$ /data/www/stonecare/cgi-bin/test.cgi
Missing name for redirect.

Here is the error generated by Apache
[Thu Jun  8 12:12:51 2000] [error] (8)Exec format error: exec of
/www/cgi-bin/test.cgi failed
[Thu Jun  8 12:12:51 2000] [error] [client xxx.xxx.xxx.xxx] malformed header
from script. Bad header=Launching... /opt/apache/bin/s: /www/cgi-bin/test.cgi

Has anyone gotten the php cgi version to work using #! directive???

Thanks

Yury Bokhoncovich wrote:

> Hi, there!
> Victor wrote:
> >
> > I am running a php compiled as a CGI executable.
> > I try to run this (saved in test.cgi)
> >
> heh-heh...I'm not 100% sure but I suppose PHPs (both 3 and 4) make use
> obsolete
> Apache environement variables.
> Try this wrapper instead of (it had been proven to work, see
> http://www.fis.ru/system/vis/
>  :-):
> ==================== Cut ========================
> #!/bin/bash
> PATH_INFO=/path/index.htm
> #$SCRIPT_NAME
> PATH_TRANSLATED=/...MyDocumentRoot(insert your own
> here).../path/index.htm
> #$SCRIPT_FILENAME
> export PATH_INFO
> export PATH_TRANSLATED
> #unset SERVER_SOFTWARE
> #unset SERVER_NAME
> #unset GATEWAY_INTERFACE
> #unset REQUEST_METHOD
> /usr/local/bin/php4b
> ===================== Cut ========================
>
> > Here is the output when I run test.cgi (php version) from command line:
> >
> > $ ./test.cgi
> > X-Powered-By: PHP/4.0.0
> > Content-type: text/html
> >
> > Hello World
>
> Right, but do you know that PHP behaves differently for CGI and CLI
> interfaces?
> if you uncomment commented-out string in my script, you "fake" your PHP
> - then it
> will consider itself in CLI mode and it will be work as in your example
> w/o problems.
>
> AFAIK Apache 1.3.6 have set PATH_INFO and PATH_TRANSLATED variables but
> it doesn't fill
> them and Apache 1.3.9/1.3.12 does not ever set them.
> Instead they all make use SCRIPT_NAME and SCRIPT_FILENAME variables.
> Maybe it's a time to change this?
> --
>
> WBR, Yury Bokhoncovich,
> SysAdmin at FIS.
>
> --
> PHP 4.0 Beta Mailing List <http://www.php.net/version4/>
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> To contact the list administrators, e-mail: [email protected]