php_value[xxx] in php-fpm pool - first declaration wins
Description
The following code:
[www]
; ...
pm.start_servers = 5
pm.start_servers = 6
php_value[default_socket_timeout] = 61
php_value[default_socket_timeout] = 62
Resulted in this result:
pm.start_servers = 6
php_value[default_socket_timeout] = 61
But I expected this output instead:
pm.start_servers = 6
php_value[default_socket_timeout] = 62
Note, with php_value entries, the first declaration wins and with other directives, the last declared value wins. This behavior of php_value entries is inconsistent with the way the rest of the php configuration files operation.
This appears to function contrary to the php-fpm configuration documentation which reads:
PHP settings passed with php_value or php_flag will overwrite their previous value.
PHP Version
7.4
Operating System
No response
Using php-fpm -tt also illuminates this behavior -- each of the duplicated php_value entries appear in the output, but in the reverse order from how they were declared:
[www]
php_value[default_socket_timeout] = 61
php_value[default_socket_timeout] = 62
php-fpm -tt
...
[18-Apr-2022 22:01:55] NOTICE: php_value[default_socket_timeout] = 62
[18-Apr-2022 22:01:55] NOTICE: php_value[default_socket_timeout] = 61
...
This is known issue and there are already various bugs reported for similar or possibly related issues:
- https://bugs.php.net/bug.php?id=80012 - PHP_ADMIN_VALUE parameter is not correctly inherited
- https://bugs.php.net/bug.php?id=72253 - phpinfo shows only first block of admin_value[disable_functions]
- https://bugs.php.net/bug.php?id=72018 - php_admin_value override
- https://bugs.php.net/bug.php?id=68171 - php_admin_value[extension] order not maintained
- https://bugs.php.net/bug.php?id=68018 - php_value directive modifies "Changeable" context (patch)
- https://bugs.php.net/bug.php?id=60387 - Problem with php_(admin)?_value/flag and load order
I will keep this open until this is fixed. It's on my list but there some higher priority items before that so it might take few months before I get to this.
Apologies for the duplicate. I see some of those tickets date back pretty far. Fixing this seems tricky, since some people probably now consider this "expected behavior" and have crafted their config to compensate. Fixing it would actually cause their config behavior to change.
Maybe it would be better to just document the current behavior?
There are very few ways I can imagine fixing this without creating side effects for existing configs and none of them seem great.
- php-fpm startup arg to choose behavior, defaulting to current behavior.
- a different set of config directives that behave "correctly" with existing ones being deprecated.
Would this be something that can be looked at for 8.5, @bukka?