What is the right way to set a global environment variable, such that it is picked up all processes, including those started via init.d (
service <service> start), on Ubuntu?
I first saw this issue with PHP, but now see it is not PHP specific. Follows is the original explanation of what I am seeing.
/etc/environment I have set:
Then in the PHP configuration file
/etc/php/7.2/fpm/pool.d/www.conf I have defined:
env[SYS_ENVIRONMENT] = $SYS_ENVIRONMENT
And then restarted php7.2-fpm. Then upon checking in the phpinfo page, the variable is listed, but not not with its value. It is defined and accessible in login shells.
I did try setting
clear_env = no in the
www.conf file, but that doesn't make the value available.
I am launching
service php7.2-fpm start, not as a child of my login shell.
What should I be doing to ensure an environment is available to all processes?
My Web server is Nginx and the OS environment is Ubuntu 18.04.1 LTS.