note 35998 deleted from install.netscape-enterprise by didou
| From: | didou@php.net | Date: | Mon, 22 Sep 2003 12:56:48 +0000 |
| Subject: | note 35998 deleted from install.netscape-enterprise by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-56900@lists.php.net to get a copy of this message | ||
Note Submitter: thetaphi@php.net
----
Because of some bogus bug reports I will explain some problems with CGI environment variables:
a) iPlanet/SunONE/Netscape is a multithreaded web server. Because of that all requests are running
in the same process space (the space of the webserver itsself) -> there is only one environment.
If you want to get CGI variables like PATH_INFO, HTTP_HOST etc. it is not the correct way to try
this in the old PHP 3.x way with getenv() or a similar way (register globals to environment, $_ENV).
Because you would only get the environment of the running webserver WITHOUT valid CGI variables.
b) Why are there (invalid) CGI variables in the environment? Answer: This is because you started the
webserver process from the admin server which runs the startup script of the webserver, you wanted
to start, as a cgi script (a cgi script inside of the admin server!!!). This is why the environment
of the started webserver has some CGI environment variables in it - because it got started by a CGI.
You can test this by starting the webserver not from the administration server. Use the unix command
line as root and start it manually - you will see there are no CGI-like environment variables.
What to do?
Simply change your scripts to get CGI variables in the CORRECT way for PHP 4.x by using the
superglobal $_SERVER: e.g. $_SERVER['HTTP_HOST']
If you have older scripts which use $HTTP_HOST,..., you should turn on register_globals in php.ini
and change the variable order to (important: remove "E" from it, because you do not need
the environment here):
variables_order = "GPCS"
register_globals = On