Apache, PHP, and JAVA_HOME on the command line.
I've got a really odd problem that I can't seem to google my way through.
We have a PHP app running under apache which executes a java prog on the command line and sends back the result. Its not rocket science, and it was all working fine under lighttpd (which seems to run as the root user by default).
Turns out, when apache is running, PHP scripts are ran under the "apache" user. Echo'ing the PATH I can see that JAVA_HOME isn't set. So, using the following script:
<?php
system('whoami');
echo "\n";
system('echo $PATH');
?>
I get the following result:
apache
/usr/local/bin:/bin:/usr/bin
So, I've set JAVA_HOME and appended it to the PATH variable in: /etc/profile, /etc/bashrc, /etc/profile.d/java.sh
No dice.
I've also changed the user apache runs as to a new user, "www", and set up the env vars in ~/.bashrc
Still no dice.
Checking the above script, I see that the running user has changed, but the path is still the same.
Anyone able to point me in the right direction?
|