I would like to be able to regenerate the value held by the environment variables inside my testing environment, and have the new values be read by PHP-FPM.
I have written a script that regenerates the environment variables, writes them to a file, and restarts PHP-FPM
# make errors error
set -eufx -o pipefail
# Generate the env settings file
php bin/cli.php genEnvSettings dev /etc/profile.d/imagickdemos.sh
# reload the env values
set +u
source ~/.bashrc
source ~/.bash_profile
set -u
#restart PHP-FPM
/etc/init.d/php-fpm restart
Running this script does not change the environment variables that PHP-FPM receives.
If I run the following commands directly from the CLI after running the above script:
source ~/.bash_profile
/etc/init.d/php-fpm restart
Then the new values for the environment variables are available to PHP-FPM. i.e. it's as if source ~/.bash_profile
inside the script has no effect.
How can I reload the environment variables inside that script, rather than having to run the reload directly from the command line? Or is there a better way to make a newly written env settings file be picked up when restarting a service?
I am using Centos 6.4 in case that makes any difference.