0

In my previous Centos 6.10 server , I have been able to pass some environment variables to httpd by adding to /etc/sysconfig/httpd

. ~/.envvars

.envvars content is

export MY_PASSWORD='somepassword'

and then in http.conf

SetEnv MY_PASSWORD ${MY_PASSWORD}

and easily accessing the variable in php trough $_SERVER['MY_PASSWORD'] but after upgrading to Centos 7.7 this stopped working, in the logs I get:

AH00111: Config variable ${MY_PASSWORD} is not defined

any help is greatly appreciated

1 Answers1

0

I solved the issue by doing two changes : in ~/.envvars after I do the export , I added this line to pass the environment variable to systemd:

systemctl import-environment MY_PASSWORD

and then instead of calling the declaration script in .bash_profile I used /etc/rc.d/init.d/functions to ensure the variables are declared before the daemon starts, for some reason the directive ExecStartPre didn't work