Centos – Setting Server Variables before Apache Loads

apache-2.2centosenvenvironment-variables

We have CentOS with Apache running on it. Basically, I have a few variables in /etc/environment and they're passed through to our Apache configs using PassEnv. The issue is that because Apache is before /etc/environment the variables are not found.

Is there a similar kind of /etc/environment file that I can add my global environmental variables into that is executed before apache (httpd) or do I have to start editing runlevels?

Kind regards,

Steve

Best Answer

Use "/etc/sysconfig/httpd" to set Apache environment.