Req #9515 [Opn->Bgs]: PHP misbehaves when run as a script with SERVER_NAME environment variable def'd
| From: | jani@php.net | Date: | Wed, 24 Nov 2010 08:35:25 +0000 |
| Subject: | Req #9515 [Opn->Bgs]: PHP misbehaves when run as a script with SERVER_NAME environment variable def'd | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-156351@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=9515&edit=1
ID: 9515
Updated by: jani@php.net
Reported by: bram at xspace dot com
Summary: PHP misbehaves when run as a script with SERVER_NAME
environment variable def'd
-Status: Open
+Status: Bogus
Type: Feature/Change Request
-Package: Feature/Change Request
+Package: *General Issues
Operating System: Linux
PHP Version: 4.0.4pl1
Block user comment: N
Private report: N
New Comment:
No bug nor feature requested here.
Previous Comments:
------------------------------------------------------------------------
[2001-03-01 23:00:39] bbonev@php.net
ooops. forgot to change type - this is expected behav, not a problem
------------------------------------------------------------------------
[2001-03-01 22:57:18] bbonev@php.net
a working setup is:
ScriptAlias /cgi-bin/ /home/someuser/cgi-bin/
AddType application/x-httpd-php .php
AddHandler php-script .php
Action php-script /cgi-bin/php
a way to solve the SERVER_NAME, PATH_INFO, etc. vars problem is to make
an 'unset' wrapper. plase note that when these vars are set php will get
the script name to execute from them. if for instance from a php script
you exec (not include) another one starting with #!/path-to-php/php the
latter invocation will execute the page requested by http again.
there are two cases:
1) php is invoked as shell script and shall process command line only no
matter what env vars are set
2) php is invoked the way described above and shall preffer env vars
(for security reasons - the /cgi-bin/php/etc/passwd issue) if no -
command line
please note that php itself cannot distinguish those cases - #2 is the
expected behaviour for all cgi setups, while IMHO #1 does not exist and
may be activated through an option
------------------------------------------------------------------------
[2001-03-01 19:01:27] bram at xspace dot com
In order to run a php script under a separate account while serving a
web page, I use suexec to run php script as a shell.
Problem: When the environment variable SERVER_NAME is defined, PHP
misbelieves that it is NOT a shell script.
In reality, it is a shell script. Bug 8898 is more less the same
problem with another symptom.
Some functions simply do not work correctly. GetMyUID() returns nothing
when PHP is running as a shell script, but the environment variable
SERVER_NAME is defined.
As a last resort, an invocation flag option should be available to
inform PHP that it is a shell script being invoked by a web server.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=9515&edit=1