|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68024 INI/ENV settings get prepended instead of appended
Submitted: 2014-09-16 08:50 UTC Modified: 2017-01-29 04:22 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: manuel-php at mausz dot at Assigned:
Status: No Feedback Package: FPM related
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: manuel-php at mausz dot at
New email:
PHP Version: OS:


 [2014-09-16 08:50 UTC] manuel-php at mausz dot at
During parsing the config FPM files FPM prepends new settings instead of appending (or replacing) them. This way it's impossible to override a previously defined setting. e.g. overriding a global setting with a pool specific.
The only way this is possible is to define the setting before including global settings, which is somewhat unexpected behavior. Additional this behavior only applies to environment variables and INI settings.

Test script:
# cat fpm.d/test.conf
prefix = /var/www/$pool
user = $pool
pm = ondemand
env[TMP] = foo
env[TMP] = bar

Expected result:
[16-Sep-2014 10:50:10] NOTICE:  env[TMP] = foo
[16-Sep-2014 10:50:10] NOTICE:  env[TMP] = bar

Actual result:
[16-Sep-2014 10:50:10] NOTICE:  env[TMP] = bar
[16-Sep-2014 10:50:10] NOTICE:  env[TMP] = foo


master-fpm-append-settings.patch (last revision 2014-09-16 08:51 UTC by manuel-php at mausz dot at)

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-09-16 08:59 UTC] manuel-php at mausz dot at
The attached patch works around this by appending the setting at the end of the key-value list. I've modified the linked list so it's a circular double linked list with the exception that the tail is not linked to the head (but head to tail). This way appending is still fast and there are no changes to the traversals.

An alternative approach would be to replace the list with a Zend HashTable.

I can also create a pull request on GitHub if that's preferred.
 [2014-10-09 01:54 UTC]
Thanks for the proposed patch, but abusing a doubly linked list is scary stuff, so I've opted to add a simple structure to keep track of both head and tail.
 [2017-01-15 07:15 UTC]
-Status: Open +Status: Feedback
 [2017-01-15 07:15 UTC]
We are awaiting a new patch for supported version of PHP, as mentioned in the (closed) PR.
 [2017-01-29 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Mon Sep 26 23:05:52 2022 UTC