N
N
Nurlan2017-01-14 15:36:01
PHP
Nurlan, 2017-01-14 15:36:01

What might be causing PHP's strange behavior when changing parameters through Nginx?

It was necessary to change the config in php, but I did not want to restart it.
I decided to do everything through fastcgi_param php_admin_value, I did everything, continued to work, but noticed that the site began to fall off periodically with an error 500. The logs were empty, neither nginx nor php knew that something had fallen.
It turned out that the matter is in the line (I write from memory):

fascgi_param PHP_ADMIN_VALUE "pinba.enabled=0";

More precisely, not in what is written in it, but in the very fact of the presence of any new parameter through fastcgi_param php_admin_value.
Combining the two lines into:
fascgi_param PHP_ADMIN_VALUE "open_base_dir=/var/www;pinba.enabled=0"

The site continued to fall, and the strange thing is that it did not fall all the time. Once every few page updates, because of this, they did not immediately understand that the matter was in the config. Everything was fixed when "\n "(...www;\n pinba...) was entered between setting the parameters.
I'm interested in:
- why the site did not crash all the time, if the settings were incorrect
- why debugging silex every other time showed the default parameter, then the one that I set
Just remember how I don't want to do it. It is interesting to understand that such strange behavior, and even more so in the logs, was empty and you need to know where to dig. I hope for your help.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
theg4sh, 2017-01-19
@theg4sh

In fact, it turns out that you are passing the php-config string through fastcgi_param PHP_ADMIN_VALUE.
Therefore, one must adhere to its standard, and probably why everything after the semicolon was interpreted as a comment and "; pinba.enabled=0" was discarded. Try to experiment to replace ";\n " with "\n", I think it should work.
Also, wouldn't it be better/more convenient to split the php settings into two nginx settings?

fastcgi_param PHP_ADMIN_VALUE "open_base_dir=/var/www"
fastcgi_param PHP_ADMIN_VALUE "pinba.enabled=0"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question