I just want my apache to register some of my predefined environment so that i can retrieve 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 variables that are available system-wide and are inherited by all spawned child processes and shells. Shell variables are variables that apply only to the current shell instance.
Delete Environment Variables You need to just use the unset command with the variable name to delete it. This command will remove the variable permanently.
Environment variables are inherited by processes in Unix. The files in /etc/profile.d are only executed (in the current shell, not in a subshell) when you log in. Just changing the value there and then restarting a process will not update the environment.
Possible Fixes:
# . /etc/profile.d/foo.sh
, then restart apacheYou also need to make sure that /etc/profile.d/
is sourced when Apache is started by init
rather than yourself.
The best fix might also depend on the distribution you are using, because they use different schemes for configuration.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With