[php-src] Issue #21299: php-fpm: php_admin_* do not overwrite php.ini , only if the value is commented out in php.ini

[email protected] (Cyborgscode)
Newsgroups php.bugs
Message-ID <[email protected]>
Issue: https://github.com/php/php-src/issues/21299
Author: Cyborgscode

### Description

Name        : php-fpm
Version     : 8.4.18


The system once was intended to override global php.ini settings with pool specific values, in special for memory management. 

Actual situation: 

global php.ini overrides pool directives:

# grep memory_limit /etc/php.ini
memory_limit = 512M

# grep memory_limit /etc/php-fpm.d/pools.conf 
php_admin_value[memory_limit] = 128MB
php_admin_value[memory_limit] = 128MB
php_admin_value[memory_limit] = 128MB
php_admin_value[memory_limit] = 128MB

but ..  ini_get('memory_limit') inside the php script shows 512M, instead of 128MB.

This MUST BE a mistake, because this way around does not make any sense.

ATM: to get 128MB set, you have to outcomment memory_limit in php.ini

The intended way must have been:

1. Read in php.ini
2. Read in pool.conf
2a. if given, override given setting.

Logic dictates, that with more than one pool.conf it's not ensured, that all pools set a memory_limit override. That said, outcommenting the global php.ini entry can't be the solution, because this would lead directly to an undefined state ( in fact it won't because hardcoded emergc defaults in php.exe prevent this). 

If that ever worked as intended, someone forgot the build unittests for this. 

Docs say this:

PHP settings passed with php_value or php_flag will overwrite their previous value. Please note that defining disable_functions or disable_classes will not overwrite previously defined php.ini values, but will append the new value instead.

Settings defined with php_admin_value and php_admin_flag cannot be overridden with ini_set().
--

Hard to say if it's a regression.

Reproducible: Always

Steps to Reproduce:
1. create a pool with a given memory limit
2. use the php default php.ini
3. restart php-fpm
4. check memory_limit in info.php 

=> global limit set.

Actual Results:          use of global limits, in case they are globally defined.
Expected Results:     use of overwritten limits.

### PHP Version

```plain
PHP 8.4.18 (fpm-fcgi) (built: Feb 10 2026 17:48:03) (NTS gcc x86_64)
Copyright (c) The PHP Group
Built by Fedora Project
Zend Engine v4.4.18, Copyright (c) Zend Technologies
    with Zend OPcache v8.4.18, Copyright (c), by Zend Technologies
```

### Operating System

Fedora 42
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.