Re: Bug #10423: HTTP_ENV_VARS is bigger, overwrites session vars
| From: | teo at gecadsoftware dot com | Date: | Fri, 20 Apr 2001 19:58:28 +0000 |
| Subject: | Re: Bug #10423: HTTP_ENV_VARS is bigger, overwrites session vars | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-52085@lists.php.net to get a copy of this message | ||
Hi colin!
On Fri, 20 Apr 2001, colin@easydns.com wrote:
> From: colin@easydns.com
> Operating system: RH7.0
> PHP version: 4.0 Latest CVS (20/04/2001)
> PHP Bug Type: Performance problem
> Bug description: HTTP_ENV_VARS is bigger, overwrites session vars
>
> After updating my CVS version of PHP, a dump of HTTP_ENV_VARS showed several new environment
> variables that weren't set in an earlier version of PHP (4.0.3pl1 for instance).
>
> Specifically in my case, HTTP_ENV_VARS['USER'] is now being set. It took me a while
> to figure out why my scripts, which use $USER as a session variable, were getting messed up.
>
That is because PHP inherits the environment from Apache, which in turn
inherits it from the shell in which you started the server. Use something like
'env -i apachectl start' when starting apache or replace the line
HTTPD=/path/to/httpd with HTTPD="env -i /path/to/httpd" in apachectl, if using
it.
that way you'll get a clean environment. If you need specific variables to be
set (like those for Oracle) use Apache SetEnv directive.
> Any reason why these env vars are getting set now where they weren't before?
yes.
>
> I have register_globals turned on. I suppose I should turn it off, and refer to everything as
> HTTP_*_VARS if I need it, right?
right
> Finally, if register_globals is off, is $GLOBALS useable? I have some functions that
> manipulate variables in the global scope.
yes it is, AFAIK.
in fact, you will find it handy to have a wrapper function/class over all these HTTP_*_VARS
arrays to validate stuff ;)
So this is not a bug, and you might want to close it.
ciao
-- teodor