views:

513

answers:

2

Hello,

Is it possible for the apache2 user, http, to have environment variables like normal users do? How would I go about setting those up, if possible?

A: 

Well, if your http user has a login shell, which most don't, you could put it in there. But that's still probably not going to do what you really want. I usually accomplish what you're trying to do by putting the environment variables in /etc/init.d/httpd.

chaos
+2  A: 

Your question is not clear about how you want to use the environment variables.

For consideration: if in /etc/httpd/conf/httpd.conf, you put

SetEnv MYVAR 10

then that environment variable should be available in your scripting language (PHP for example). In PHP, it can be accessed by $_SERVER['MYVAR']

gahooa
Actually, yes, that's what I want. It will work. Thanks!
flummoxed