Apache webserve SetEnv PATH???
I'm setting up a web server on my CentOS 5.4.3 (x86_64) system and the Python toolkit that I'm using (RDKit - RDKit.org) expects to have its location specified in the PATH environment variable. This is all good and fine when I use the toolkit on my own as I have
export RDBASE=/opt/RDKit export PATH=$PATH:$RDBASE in my .bashrc. But, since this is a web server, I need to have the PATH set for Apache. I can get all the other necessary environment variables set from httpd.conf, but not PATH. I also tried to include a new .sh file in /etc/profile.d - rdkit.sh - which contained the specified export PATH statement above, but Apache doesn't recognize it even if I include the PassEnv directive in httpd.conf: PassEnv PATH Any ideas??? -Kirk |
I guess you simply have to set the variable system wide in /etc/profile with the mentioned export statements, then
'source /etc/profile' and restart apache. '/usr/sbin/apache2ctl restart' |
Try the SetEnv directive of apache.
I always tested the env of apache within php like this Code:
passthrough('env') P.S. Don't forget to restart apache after config changes |
j-ray:
I tried adding the export line to /etc/profile - no luck. I also notice that if I look at the environment variables in apache with this code running from my web page: for a in os.environ.keys(): print a, ' = ', os.environ[a], '<BR>' and comparing that to what I get as my user or root, the PATH variable is different from all of them. In other words, I can see that this approach changed the root PATH variable, but it seems to have no effect with the webserver. zhjim: Thanks for the idea, but I've tried that. I have all my other necessary environment variables set using SetEnv within httpd.conf. I also tried PassEnv PATH once I had root's environment variable set correctly - still no luck. Any other ideas out there??? How do I get to the apache user's account and how it has its environment variables set? -Kirk |
Work around
Well, I can't seem to affect the PATH, but as it turns out I can opt to set PYTHONPATH instead. I also discovered that within the httpd.conf file, I have to explicitly spell out the directories. In other words, this didn't work:
SetEnv RDBASE /opt/RDKit_Q32009_1 SetEnv PYTHONPATH $RDBASE:$RDBASE/bin but it DID work as this: SetEnv RDBASE /opt/RDKit_Q32009_1 SetEnv PYTHONPATH /opt/RDKit_Q32009_1:/opt/RDKit_Q32009_1/bin From pain comes knowledge, eh? -Kirk |
Quote:
|
All times are GMT -5. The time now is 12:20 PM. |