I want to use environment variables in my PHP applications both CLI and FPM. What I do is I:
- export some variables in
/etc/environment
. - configure both
php.ini
(CLI and FPM) tovariables_order = "EGPCS"
. - configure FPM
www.conf
toclear_env = no
What I expect is that environment variables are available both in CLI and FPM application. In fact that works only for CLI. FPM's $_ENV
does not contain those environment variables.
I noticed that it's possible to define environment variables in www.conf
but it's inconvenient since I have to copy-paste all variables from /etc/environment
and always keep two files in sync.
The question is: is it possible to pass all environment variables directly to a PHP-FPM application without copy-pasting them in www.conf
?