Re: Question about HTTP_ENV_VARS, PHP, and Apache
| From: | Rasmus Lerdorf | Date: | Wed, 16 Jan 2002 06:01:49 +0000 |
| Subject: | Re: Question about HTTP_ENV_VARS, PHP, and Apache | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-80659@lists.php.net to get a copy of this message | ||
This has been discussed a number of times here. Apache will always inherit
the environment of the user that starts it. You should start it with a
clean environment. ie. add "env -i" to whatever script starts your httpd
server.
-Rasmus
On Tue, 15 Jan 2002, Michael Sims wrote:
> This may be more of an Apache question, but I was hoping that someone here
> would have an idea about this.
>
> I tracked down a bug in one of my scripts that was caused by environment
> variable that was being registered as global without my knowledge (due to
> the register_globals setting). My script was depending on this variable
> not being set in certain conditions but I didn't take into account the fact
> that it could be set via an environment variable.
>
> While troubleshooting this I was looking through the output of phpinfo()
> and I found something curious in the environment variables across the three
> different servers that I administer. All three are running Redhat, Apache
> 1.3.19, and PHP 4.0.4.pl1, with PHP compiled as an Apache module
> (--with-apxs). One of the servers is Redhat 7.0, the other two are Redhat
> 7.1. On both the Redhat 7.1 servers, phpinfo() reports the following
> environment variables:
>
> user: michaels
> logname: michaels
> bash_env: /home/michaels/.bashrc
> mail: /var/spool/mail/michaels
>
> "michaels" is the user account that I use on these servers to do a majority
> of my work, only su'ing to root when absolutely necessary.
>
> I'm confused as to why these variables exist. I know for a fact that
> Apache is running as "nobody". That's what the httpd.conf file is
> configured for and I can verify that by viewing the output of "ps aux" I
> did build apache and php as this user, but I su'ed to root for the "make
> install" portion. I launched apache with "apachectl" as root.
>
> On the Redhat 7.0 machine these env vars don't exist.
>
> Can anyone enlighten me or perhaps point me to a source of more info? Any
> help would be appreciated...
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>