I've been setting custom env vars for Apache 1 of 2 ways;
1 - Changing the passwd file so Apache has a shell and loading a custom .bashrc file.
2 - Using the SetEnv directive in my httpd.conf file.
I'm crazy about neither one as they both have limitations;
1 - I don't like giving Apache its own shell.
2 - The SetEnv directive only takes 2 args so if I have a var with multiple values like a path, it won't work.
What's the cleanest way to set complex env vars for Apache?
aurfalien@gmail.com wrote:
What's the cleanest way to set complex env vars for Apache?
What are you needing to set such variables for? I've run apache for probably nearly 15 years now, doing many different types of things but never have I had to set complex environment variables.
Have you tried sourcing the variables from the init script? One way may be to put the variables in /etc/sysconfig/httpd
Perhaps there is a better way to do what you want without needing such environment variables.
nate
Hi Nate,
We have our internal server running scripts and referencing variables in custom paths.
So for example;
Some one runs a Python script of http://intranet/batch
The batch.py references some variables defined in certain paths.
I need a good way of defining a path with multiple vars like FOO=/foo:/ bar... etc...
I'm not having too much luck with setting vars in /etc/sysconfig/httpd either.
On Oct 19, 2009, at 10:58 AM, nate wrote:
aurfalien@gmail.com wrote:
What's the cleanest way to set complex env vars for Apache?
What are you needing to set such variables for? I've run apache for probably nearly 15 years now, doing many different types of things but never have I had to set complex environment variables.
Have you tried sourcing the variables from the init script? One way may be to put the variables in /etc/sysconfig/httpd
Perhaps there is a better way to do what you want without needing such environment variables.
nate
CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
aurfalien@gmail.com wrote:
Hi Nate,
We have our internal server running scripts and referencing variables in custom paths.
So for example;
Some one runs a Python script of http://intranet/batch
The batch.py references some variables defined in certain paths.
I need a good way of defining a path with multiple vars like FOO=/foo:/ bar... etc...
Could you not have the scripts themselves grab the variables?
nate
Hi Nate,
These scripts are called by the user in a standard env and would prefer it to stay un modified when running via Apache.
On Oct 19, 2009, at 11:17 AM, nate wrote:
aurfalien@gmail.com wrote:
Hi Nate,
We have our internal server running scripts and referencing variables in custom paths.
So for example;
Some one runs a Python script of http://intranet/batch
The batch.py references some variables defined in certain paths.
I need a good way of defining a path with multiple vars like FOO=/ foo:/ bar... etc...
Could you not have the scripts themselves grab the variables?
nate
CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
aurfalien@gmail.com wrote:
I've been setting custom env vars for Apache 1 of 2 ways;
1 - Changing the passwd file so Apache has a shell and loading a custom .bashrc file.
2 - Using the SetEnv directive in my httpd.conf file.
I'm crazy about neither one as they both have limitations;
1 - I don't like giving Apache its own shell.
2 - The SetEnv directive only takes 2 args so if I have a var with multiple values like a path, it won't work.
What's the cleanest way to set complex env vars for Apache?
I'm not aware of any exceptions to environment variables being single key/value strings. The value of a path is a single string as far as the environment mechanism goes, even if the code that evaluates it splits on :'s by convention. I don't think there is such a thing as a complex env var.
Hi Les,
What I mean is that if I use the Apache directive;
SetEnv BATCHPATH /foo
It works.
If I set;
SetEnv BATCHPATH /foo:/bar
Apache errors with a syntax that SetEnv takes 2 args only, a key and a value.
I need multiple values for 1 key, as one would see in a standard mix env.
Any ideas?
On Oct 19, 2009, at 11:11 AM, Les Mikesell wrote:
aurfalien@gmail.com wrote:
I've been setting custom env vars for Apache 1 of 2 ways;
1 - Changing the passwd file so Apache has a shell and loading a custom .bashrc file.
2 - Using the SetEnv directive in my httpd.conf file.
I'm crazy about neither one as they both have limitations;
1 - I don't like giving Apache its own shell.
2 - The SetEnv directive only takes 2 args so if I have a var with multiple values like a path, it won't work.
What's the cleanest way to set complex env vars for Apache?
I'm not aware of any exceptions to environment variables being single key/value strings. The value of a path is a single string as far as the environment mechanism goes, even if the code that evaluates it splits on :'s by convention. I don't think there is such a thing as a complex env var.
-- Les Mikesell lesmikesell@gmail.com _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
aurfalien@gmail.com wrote:
Hi Les,
What I mean is that if I use the Apache directive;
SetEnv BATCHPATH /foo
It works.
If I set;
SetEnv BATCHPATH /foo:/bar
Apache errors with a syntax that SetEnv takes 2 args only, a key and a value.
Doesn't for me on stock Apache in CentOS 5.3. You have something unique going there? Suppose you counld try enclosing the value in double quotes... -Alan
Hi Les,
What I mean is that if I use the Apache directive;
SetEnv BATCHPATH /foo
It works.
If I set;
SetEnv BATCHPATH /foo:/bar
Apache errors with a syntax that SetEnv takes 2 args only, a key and a value.
You have something unique going there?
Yea, the fact that I'm an idiot!
As usual, my typing is killing me and multiple values are fine, it was just a syntax error of my doing.
Sorry for the wasted traffic on this one.
aurfalien@gmail.com wrote:
Hi Les,
What I mean is that if I use the Apache directive;
SetEnv BATCHPATH /foo
It works.
If I set;
SetEnv BATCHPATH /foo:/bar
Apache errors with a syntax that SetEnv takes 2 args only, a key and a value.
Doesn't happen here. If I paste that line into my httpd.conf, apache digests it and reports this in /server-info:
Current Configuration: In file: /etc/httpd/conf/httpd.conf 1: SetEnv BATCHPATH /foo:/bar
-- Les Mikesell lesmikesell@gmail.com
aurfalien@gmail.com wrote:
Hi Les,
What I mean is that if I use the Apache directive;
SetEnv BATCHPATH /foo
It works.
If I set;
SetEnv BATCHPATH /foo:/bar
Apache errors with a syntax that SetEnv takes 2 args only, a key and a value.
I need multiple values for 1 key, as one would see in a standard mix env.
Any ideas?
Which Apache version?
I put your second example into my httpd.conf and didn't see any errors. I do see the error you report if I insert a space into the path.
Hi Les,
What I mean is that if I use the Apache directive;
SetEnv BATCHPATH /foo
It works.
If I set;
SetEnv BATCHPATH /foo:/bar
Apache errors with a syntax that SetEnv takes 2 args only, a key and a value.
I need multiple values for 1 key, as one would see in a standard mix env.
Any ideas?
I do see the error you report if I insert a space into the path.
I'm an adiot.
A typo caused the errors and my typing or beyond horrid.
I must say, this is the nicest list, every one willing to help.
Thanks foe the response.
On Mon, Oct 19, 2009 at 12:49 PM, aurfalien@gmail.com wrote:
I've been setting custom env vars for Apache 1 of 2 ways;
1 - Changing the passwd file so Apache has a shell and loading a custom .bashrc file.
2 - Using the SetEnv directive in my httpd.conf file.
I'm crazy about neither one as they both have limitations;
1 - I don't like giving Apache its own shell.
2 - The SetEnv directive only takes 2 args so if I have a var with multiple values like a path, it won't work.
What's the cleanest way to set complex env vars for Apache?
I put "export FOO=bar" in /etc/sysconfig/httpd and then PassEnv FOO in httpd.conf. Then scripts (PHP in my case) run by apache inherit FOO in the environment. I can't speak for python though. Don't know why it wouldn't work with what you call complex vars.
-- Jeff