I just want my apache to register some predefined environment so that I can get it using getenv function in php. How can i do this? I tried adding /etc/profile.d/foo.sh with export FOO = / bar / baz using root and restarted apache.
Environment variables are inherited by processes on Unix. Files in the /etc/profile.d file are executed only (in the current shell, and not in the subshell) at the login. Just changing the value and then restarting the process will not update the environment.
Possible fixes:
# . /etc/profile.d/foo.sh
, /etc/profile.d/ , Apache init, .
/etc/profile.d/
init
, .
SetEnv (/etc/httpd/conf.d/*.conf,.htaccess...). , /etc/sysconfig/httpd ( RPM) (: ).
. , , , , , Apache. , . . Apache , sourcing/etc/profile.d/yourprofile.sh /etc/sysconfig/httpd
Apache .
, - , - , , PHP -.
. Apache mod_env:
If you only need env vars for Apache, then editing /etc/apache2/envvarsand restarting Apache worked for me . I added these settings:
/etc/apache2/envvars
export LANG='en_US.UTF-8' export LC_ALL='en_US.UTF-8'