PHP reads one main php.ini, then every file in a scan directory in name order. On Ubuntu 225 each SAPI has its own pair under /etc/php/8.5/<sapi>/, which is why the CLI and FPM reported different memory limits in SAPIs. Ask PHP rather than guessing:
php --ini | head -4
php -i | grep -E '^(memory_limit|opcache.enable_cli|extension_dir)'
php -d memory_limit=512M -r 'echo ini_get("memory_limit"), PHP_EOL;'Configuration File (php.ini) Path: "/etc/php/8.5/cli" Loaded Configuration File: "/etc/php/8.5/cli/php.ini" Scan for additional .ini files in: "/etc/php/8.5/cli/conf.d" Additional .ini files parsed: /etc/php/8.5/cli/conf.d/10-mysqlnd.ini, extension_dir => /usr/lib/php/20250925 => /usr/lib/php/20250925 memory_limit => -1 => -1 opcache.enable_cli => Off => Off 512M
Each file in conf.d is a symlink into /etc/php/8.5/mods-available/, numbered to set the load order (10-pdo.ini before 20-pdo_mysql.ini). Toggle one with sudo phpenmod intl or phpdismod, list them with php -m, and inspect one with php --ri pdo_mysql. -d overrides a setting for one command, ini_set() for the rest of one request, and under FPM a .user.ini applies to its directory tree. After editing /etc/php/8.5/fpm/php.ini, run sudo systemctl reload php8.5-fpm, because workers read it at startup.
20250925 is the Zend module API number: an extension built for one minor version will not load into another. PHP 8.5 adds two always-on modules, uri (RFC 3986 and WHATWG URL parsing, The URI Extension) and lexbor (the HTML5 parser behind Dom\HTMLDocument), and builds OPcache into every binary: there is no opcache.so any more, only opcache.enable and opcache.enable_cli to switch it.