Re: PHP scripts use/get passed root's environment?
| From: | john | Date: | Tue, 24 Dec 2002 03:41:13 +0000 |
| Subject: | Re: PHP scripts use/get passed root's environment? | ||
| References: | 1 | Groups: | php.install |
| Request: | Send a blank email to php-install+get-9435@lists.php.net to get a copy of this message | ||
My phpinfo() section looks pretty much the same as yours.
I think PHP is not actually running as root--if you look in the Apache section, you should find a User/Group section that has the actual user account PHP uses. Mine lists nobody(99)/99, and that's the owner of any files I create from a PHP page...
Apache is generally started by root, and then spawns sub-processes running as a non-privileged user. These sub-processes handle the actual requests. It looks to me that Apache doesn't change the system environment for these sub-processes--it just changes the user account they run under.
Hope that helps,
John Locke
http://freelock.com
Terrence Koeman wrote:
PHP 4.2.3 on Apache 1.3.27 on FreeBSD 4.7-STABLE; Apache runs with uid/gid 80/80 and php is loaded as module. For some reason all PHP scripts on my box run in root's environment instead of one created by apache. This is the environment section from phpinfo: http://ra.phid.ae/phpinfo.html And I guess it should look like this: http://ra.phid.ae/phpinfo2.html The issue remains if I rename the php.ini to something else to get the default values and restart apache. CGI scripts (perl) have the right environment, so i'm pretty sure it's a PHP thing. Any ideas? Thanks in advance.