For Programmers: Free Programming Magazines  


Home > Archive > PHP Installation > April 2007 > PHP environment under Apache









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author PHP environment under Apache
Tony van der Hoff

2007-04-30, 7:00 pm

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
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com