PHP environment under Apache
| From: | Tony van der Hoff | Date: | Mon, 30 Apr 2007 17:43:50 +0000 |
| Subject: | PHP environment under Apache | ||
| Groups: | php.install | ||
| Request: | Send a blank email to php-install+get-17990@lists.php.net to get a copy of this message | ||
Hi,
Mandriva Linux 2007.0, Apache 1.3.37, PHP 4.4.4, mod-perl 1.30.
Having just completed a server rebuild, (from distro binary RPMs - which
have previously worked OK), I find that I was unable to access ENV["TMPDIR"]
from php scripts when running under apache. Investigation showed that
ENV["TMPDIR"] contains "/root/tmp", so the result is hardly surprising.
I also note that ENV["ENV"] contains "/root/.bashrc", and ENV["USERNAME]
contains "root".
Inserting putenv( "TMPDIR=/tmp" ); into the script works round the problem,
but is hardly a neat fix.
Running php from the command line results in the correct environment for the
current user.
Apache is running as user apache(79), group webmaster(505), and _SERVER[...]
contains the expected values; _SERVER["TMPDIR"] contains /home/tony/tmp.
OK, so PHP thinks its root. How and where does this get set, and how do I
fix it?
Any answers will receive my undying gratitude.
--
Tony van der Hoff | mailto:tony@vanderhoff.org
Buckinghamshire, England