Re: [PHP4BETA] CGI version of PHP not working

[email protected] (Yury Bokhoncovich) Thu, 08 Jun 2000 14:48:00 +0700
Newsgroups php.version4
Organization FIS
Message-ID <[email protected]>
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.