PHP runtime: extensions, owned INI and OPcache in FPM
Derive PHP modules from local Composer dependencies, then check the owned INI, scan directory and OPcache through two FPM pools.
Installation and subsequent steps require PHP 8.5.12 or a newer stable release in the 8.5 branch. PHP 8.5.12 is a security release; the coordinated disclosure is discussed in OpenAI’s report. Check both CLI and the running FPM version: an updated package on disk alone does not establish that an existing process has been updated.
After connecting Nginx to two FPM pools, we need to check whether PHP provides the capabilities required by the actual application. The interpreter version is not enough: libraries may need GD, Intl, Redis or XML modules, and custom FPM may read a different INI from the php command in a terminal.
We continued the manual exercise in the same disposable Debian 13 VM with PHP 8.5.12. Requirements came from composer.json and the non-dev dependencies in the local Article Admin and Frontend composer.lock files. The applications were not installed on this fixture: HTTP executed a diagnostic index.php.
The list starts with Composer
Both root manifests require PHP ≥8.5 and ctype, dom, exif, fileinfo, gd, iconv, intl, json, pdo_mysql, redis and simplexml. The locked dependencies add date, filter, hash, libxml, mbstring, pcre, random, reflection, spl and xml. Admin also needs posix, xmlreader, xmlwriter and zip. This is the union of specific dependencies, not a universal list for every site.
Some capabilities are built into the interpreter; others come from shared modules. We added cURL separately for the actual Guzzle transport: the Composer ext-* list did not capture this HTTP handler choice. Having pdo_mysql or redis here means that the PHP module is available, not that a connection to the corresponding data server has been tested.
An installed package is not a loaded FPM module
The custom unit starts FPM with /etc/deploy-cli/php85/php.ini and PHP_INI_SCAN_DIR=/etc/deploy-cli/php85/scan. We explicitly created 20 INI files in that directory. Module names in loading order:
mysqlnd, pdo, xml, ctype, curl, dom, mbstring, exif, fileinfo, gd, iconv, igbinary, intl, pdo_mysql, posix, simplexml, xmlreader, xmlwriter, zip, redis
Each file contains extension=name.so; mysqlnd and pdo precede pdo_mysql, while igbinary precedes redis. These twenty files are not the full get_loaded_extensions() list: built-in capabilities need no individual scan file. We did not automatically import every distribution INI from another SAPI.
The diagnostic HTTP request checked these calls:
php_ini_loaded_file();
php_ini_scanned_files();
get_loaded_extensions();
ini_get('memory_limit');
function_exists('curl_init');
opcache_get_status(false);
Both workers reported the custom INI, scan paths only from the specified directory, memory_limit 128M and an available curl_init. Their extension lists contained every tested requirement. This is a synthetic HTTP runtime check; the full Composer platform check and starting the actual application belong to a separate delivery step.
Check OPcache inside the running worker
In the PHP 8.5 build used here, Zend OPcache was already present even in php -n -m without scan files. There is no separate extension=opcache.so among the twenty files. In the custom INI we enabled caching for FPM and left it disabled for CLI:
memory_limit = 128M
opcache.enable = 1
opcache.enable_cli = 0
opcache.memory_consumption = 128
opcache.max_accelerated_files = 10000
opcache.validate_timestamps = 1
opcache.revalidate_freq = 0
opcache.jit_buffer_size = 0
The OPcache documentation explains these settings. This profile checks timestamps without a waiting interval and disables the JIT buffer. After repeated HTTP requests, opcache_get_status reported enabled, two cached scripts and increasing hits; used cache memory was about 8.8 MiB. We complemented the configuration file with an observation from FPM itself.
A script limit and a service limit
Each of the two static pools has one worker. PHP memory_limit is 128M, while the custom systemd unit has MemoryMax=512M. The PHP manual describes memory_limit; it is not a limit for the entire service containing the master, shared OPcache and two workers.
At measurement time both workers were largely idle apart from diagnostic requests. Each had roughly 18.4 MiB RSS and 6.2 MiB PSS; the master had about 39.7 MiB RSS and 22.2 MiB PSS. Separately, cgroup memory.current was about 15.4 MiB. These are different metrics: RSS counts shared pages again in each process, PSS apportions their share, and the cgroup maintains its own accounting. Adding RSS values and calling the result the server requirement would be misleading.
These numbers describe this test profile, not a production RAM recommendation. Choosing worker counts and memory limits needs the actual application workload, its requests, caches and accompanying services. Here we established a concrete starting point: a known INI, an explicit module set, working OPcache and a measured lightweight runtime.
Verified the same profile through the CLI
In a separate clean CLI run, the full PHP profile installed 54 new packages including logrotate, created two pools and completed activation-apply plus independent activation-verify. The verifier queried each actual FastCGI socket and checked the worker’s effective UID/GID, extensions and INI. The executed command below uses generalized protected paths and already checked SHA values:
deploy-cli host fpm activation-verify --joint-start-policy \
--env-file "$PRIVATE_DIR/administrator.env" \
--request-file "$PRIVATE_DIR/request.json" \
--fpm-file "$PRIVATE_DIR/php-profile.json" \
--key-file "$PRIVATE_DIR/repository.gpg" \
--key-sha256 "$PUBLIC_KEY_SHA256" \
--dependencies-file "$PRIVATE_DIR/php-activation-deps.json" \
--plan-file "$PRIVATE_DIR/php-activation-plan.json" \
--plan-sha256 "$APPROVED_PLAN_SHA256"
This summarizes the actual records of both workers in the completed journal. extensions_count counts names in the extensions array; INI values shared by both pools are grouped under shared_ini.
{
"s200admin": {
"sapi": "fpm-fcgi",
"php_branch": "8.5",
"extensions_count": 39,
"pdo_drivers": [
"mysql"
],
"opcache_running": true
},
"s200front": {
"sapi": "fpm-fcgi",
"php_branch": "8.5",
"extensions_count": 39,
"pdo_drivers": [
"mysql"
],
"opcache_running": true
},
"shared_ini": {
"memory_limit": "128M",
"opcache.enable": "1",
"opcache.enable_cli": "0",
"opcache.memory_consumption": "128",
"opcache.jit_buffer_size": "0"
}
}
Both workers loaded pdo_mysql, redis, igbinary, intl, mbstring, curl, gd and zip, among other extensions. OPcache ran in FPM; CLI caching and JIT remained disabled. This demonstration profile uses a 128M request memory_limit; production limits are determined separately from application load.
Three timers: separate CLI start and startup enablement
After PHP-FPM and Nginx, we separately started maintenance timers for both pools and the master log on the same local educational VM. Configuration files, session-clean.py and logrotate remained from the initial setup. The new plan references the completed PHP startup and maintenance; it does not replay the original maintenance oneshots.
Variables below contain private paths and previously recorded identifiers. php-maintenance-reference.json contains plan_file, plan_sha256 and manifest_sha256 for the original completed maintenance. The timer plan is reviewed before apply; its SHA identifies those exact approved bytes.
TIMER_STARTUP_ARGS=(
--env-file "$ADMIN_ENV"
--request-file "$PRIVATE_DIR/original-request.json"
--fpm-file "$PRIVATE_DIR/php-profile.json"
--key-file "$PHP_REPOSITORY_KEY"
--key-sha256 "$PHP_REPOSITORY_KEY_SHA256"
--references-file "$PRIVATE_DIR/history-references.json"
--php-startup-request-file "$PRIVATE_DIR/php-startup-console-request.json"
--activation-file "$PRIVATE_DIR/php-activation-reference.json"
--firewall-pin-file "$PRIVATE_DIR/firewall-pin.json"
--php-startup-plan-file "$PRIVATE_DIR/php-startup-plan.json"
--php-startup-plan-sha256 "$PHP_STARTUP_PLAN_SHA256"
--php-startup-manifest-sha256 "$PHP_STARTUP_MANIFEST_SHA256"
--current-request-file "$PRIVATE_DIR/timer-startup-console-request.json"
--maintenance-reference-file "$PRIVATE_DIR/php-maintenance-reference.json"
--plan-file "$PRIVATE_DIR/timer-startup-plan.json"
)
deploy-cli host runtime-startup timers plan "${TIMER_STARTUP_ARGS[@]}"
deploy-cli host runtime-startup timers apply "${TIMER_STARTUP_ARGS[@]}" \
--plan-sha256 "$TIMER_STARTUP_PLAN_SHA256" --approve-privileges
The CLI first starts only the three .timer units, checks active/waiting, then creates three links in timers.target.wants and verifies enabled through a new SSH connection. The files retain OnActiveSec=30min and OnUnitActiveSec=30min: an initial run 30 minutes after timer activation, then an interval from the last activation of the associated service. This is not a calendar schedule or an exact-second guarantee: AccuracySec is 1min.
At observation, maintenance services were inactive/dead with Result=success; timers were active/waiting and enabled. This establishes a ready schedule, not a new cleanup happening at that instant.
After starting the timers, we performed one ordinary reboot of the local VM; an independent serial console confirmed the new boot.
In the new boot, the CLI only read state. PHP-FPM, Nginx, MySQL, Redis and Elasticsearch were active/running and enabled; the firewall was active/exited; all three timers were active/waiting and enabled. Both PHP pools again executed an HTTP request, and all 20 control requests had their expected statuses.

