LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 12-01-2009, 06:52 PM   #1
KirkD
Member
 
Registered: Oct 2007
Posts: 58

Rep: Reputation: 15
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
 
Old 12-02-2009, 04:37 AM   #2
j-ray
Senior Member
 
Registered: Jan 2002
Location: germany
Distribution: ubuntu, mint, suse
Posts: 1,591

Rep: Reputation: 145Reputation: 145
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'
 
Old 12-02-2009, 04:45 AM   #3
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
Try the SetEnv directive of apache.
I always tested the env of apache within php like this

Code:
passthrough('env')
Cheers Zhjim

P.S.
Don't forget to restart apache after config changes
 
Old 12-02-2009, 01:38 PM   #4
KirkD
Member
 
Registered: Oct 2007
Posts: 58

Original Poster
Rep: Reputation: 15
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
 
Old 12-02-2009, 03:56 PM   #5
KirkD
Member
 
Registered: Oct 2007
Posts: 58

Original Poster
Rep: Reputation: 15
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
 
Old 12-03-2009, 01:51 AM   #6
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
Quote:
Originally Posted by KirkD View Post
From pain comes knowledge, eh?
I always learn by doing things wrong, rights for loosers and eegheads
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
webserve to access mysql bob3dan Fedora 2 12-15-2008 01:08 AM
Apache path siva19185 Linux - Newbie 2 06-28-2008 03:33 PM
Apache 1.3 mod_env SetEnv problem dafut Linux - Server 0 03-13-2007 09:11 PM
Apache path and kde path questions darkraider Debian 1 11-12-2005 05:07 AM
How do i make a Webserve GameFoX Linux - Newbie 7 02-20-2004 08:19 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 10:10 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration