Why each PHP version has its own settings
- The main php.ini, then any files in the scan directory (conf.d), loaded in alphabetical order.
- FPM pool directives such as php_value[memory_limit] or php_admin_value[memory_limit].
- Per-directory files: .user.ini for FPM and CGI, or php_value lines in .htaccess for handlers that support them, such as mod_php or LiteSpeed LSAPI.
- ini_set() calls in the application itself, unless the pool locked the value with php_admin_value.
Check what the shell sees with php --ini
BASH
# Which version is the default php, and what does it load?
php -v
php --ini
# Ask the version the site actually uses (binary names vary by distro and panel)
php8.2 --ini
php8.2 -i | grep -E '^(memory_limit|upload_max_filesize|post_max_size) '
# The FPM binary has its own php.ini; -i prints its view (confirm with --help)
php-fpm8.2 -i | grep -E '^(Loaded Configuration File|memory_limit) 'Ask the web server, not the shell
PHP
<?php
// Temporary diagnostic. Delete this file immediately after use.
header('Content-Type: text/plain');
echo 'SAPI: ', PHP_SAPI, PHP_EOL;
echo 'Version: ', PHP_VERSION, PHP_EOL;
echo 'Loaded php.ini: ', php_ini_loaded_file() ?: 'none', PHP_EOL;
echo 'Scanned ini files: ', php_ini_scanned_files() ?: 'none', PHP_EOL;
foreach (['memory_limit', 'upload_max_filesize', 'post_max_size', 'max_execution_time'] as $key) {
echo key, ': ', ini_get(key), PHP_EOL;
}Find where the old value was actually set
BASH
# Debian/Ubuntu layout; adjust version numbers and paths for your setup
grep -RnE 'memory_limit|upload_max_filesize|post_max_size' /etc/php/8.1/
grep -RnE 'memory_limit|upload_max_filesize|post_max_size' /etc/php/8.2/
# Per-directory overrides inside site roots
find /var/www \( -name '.user.ini' -o -name '.htaccess' \) -exec grep -l 'memory_limit' {} +