[CentOS] apache env vars - best practices
jlar310 at gmail.com
Mon Oct 19 18:51:03 UTC 2009
On Mon, Oct 19, 2009 at 12:49 PM, <aurfalien at 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.
More information about the CentOS