Reputation: 299
I have set up in 1 VM (centos7):
For this task, I have followed this guide (of course, I had to change some settings to make it work in my environment)
In some point of the guide, I had to uncomment these lines in the config file for php-fpm /etc/php-fpm.d/www.conf
env[HOSTNAME] = $HOSTNAME
env[PATH] = /usr/local/bin:/usr/bin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp
In the guide, It was said that these were php-fpm system environment variables. I had to uncomment them to active them.
I know nothing about these variables, but I know that they are taking as values some info of my system.
Also, I have to say that my nextcloud is working without errors with these variables uncommented. But just for testing, I commented the lines back again, and nextcloud continued working as usual.
So what I want to learn and currently I can't understand is:
Why the guide says that these variables are needed? What is the function of these variables, if activated, in the communication process between nginx and php-fpm?
Upvotes: 0
Views: 1343
Reputation: 9875
Why the guide says that these variables are needed?
Because it is a somewhat junky, extraneous addition to the article.
What is the function of these variables
The primary use would be, I guess, having an environment variable pass with a different value for specific PHP-FPM pool. E.g. you have installed some CLI tool (converting between image formats for example) under /usr/local/bin/foo
). Then you want to have your website to be able to launch that. It can't unless it can find it in PATH
environment variable (which, by default does not include /usr/local/bin
.
So you have two options there:
Change the PATH
for the PHP-FPM user (defined in pool settings), e.g. in ~/.bashrc
env[PATH] = /usr/local/bin:/usr/bin:/bin
So this is just one of the ways to achieve the same.
if activated, in the communication process between nginx and php-fpm?
No, this is nothing about NGINX->PHP-FPM. It is just how PHP-FPM will run its worker processes (with which environment), so it affects how/which environment PHP scripts will see.
Upvotes: 1