I have a set of environment variables, which is created with a shell script config called from my ~/.bashrc.
Having a new user www-data running a local webserver (with lighttpd), I need it to benefit from those environment variables. More specifically, the webserver runs php scripts which need them.
Therefore, I would like to move the call to config into a general file.
Reading the Ubuntu documentation related to environment variables, I tried to:
- write
export VAR="variableto/etc/profile.d/config.sh, but when running the webserver scripts, the$VARvariable is not accessible. - write
export VAR="variableinto/etc/bash.bashrc, but same issue
=> How can I share an environment variable between different unix users if I cannot make them logout (like www-data)?
Moreover, I need this environment to be loaded regularely (in case the configuration changes).
=> How can I be sure that the webserver php scripts are using the correct environment variables, without having to load the config inside every script?