[5.21.0] — 2026-11-29
OPcache, sized to the server — and given to a pool only when its user may read the file. PHP's own OPcache is the same on a 1 GB VPS and on a 64 GB server, and a full one says nothing: PHP stops caching what does not fit and compiles it at every request, for every app on that PHP version. Cipi now sizes it for the server's RAM, shows how full it is, and warns when it is full. Looking at it showed something else: the cache of a PHP-FPM is one for all its pools, and PHP gave a script in it to any of them.
Security
- A script in OPcache was given to a pool whose user cannot read it. One PHP-FPM per PHP version serves every app on that version, and its OPcache is shared by all its pools. PHP gives a cached script without opening the file — so neither
open_basedirnor the permissions of the other app's home were asked: a pool couldincludea PHP file another app had cached (itswp-config.php, itsbootstrap/cache/config.php), which it can read neither on disk nor through any file function. PHP has the check and ships with it off:opcache.validate_permission = 1is now written for every PHP-FPM, and a cached script is given only to a pool whose user may read the file.- Who was exposed: a server with two or more PHP-FPM apps on the same PHP version, to PHP code running in one of them (an app that was broken into, a tenant). Octane apps have a PHP and a cache of their own each. Nothing changes for an app that reads its own files.
- Migration 5.21.0 writes it for every installed PHP and restarts each PHP-FPM once (see below).
cipi php opcachesays, for each PHP-FPM, whether it runs with the check. - Other apps' cached files are still listed by
opcache_get_status(true), andopcache_reset()still empties the cache of every app on that PHP:opcache.restrict_apicloses both, and breaks the apps that call them — it is left to the server's owner.
- A campaign link shares its cached copy only with plain values. A link with tracking parameters only (
?utm_source=…) is one copy for all of them (5.20.0), written by the first click with that click's values in front of PHP: a page that printsutm_sourceprinted the first visitor's to everyone who clicked after — text of a stranger's choosing, markup if the page does not escape it. The values that share the copy are now letters, digits,. _ ~ * , : @ ! / + | -, a space or one of those as%XX, the bytes of an accented letter, and the=that pads the end of an encoded id (igshid=…==). A link with< > " ' & ( ) ; \, a%of anything else, or an=inside a value is a query string like any other: never cached, PHP answers it.- One place (
CACHE_TRACKING_VALUEinlib/cache.sh) for both maps. The migration writes the maps again, nginx tested before the reload; refused, the maps as they were. The cached pages stay. - What it does not change: the copy still carries what PHP made of the first click's (plain) values. A landing page that reads
gclidorutm_*on the server belongs incipi cache <app> exclude.
- One place (
cipi-cache-clearchecks names with the C alphabet. sudo lets the caller'sLANGandLC_*through, and[a-z]is not the same letters in every language: the helper setsLC_ALL=Cbefore it checks the app, the host and the paths. Nothing was found that got through; it no longer depends on that.
Added
-
OPcache sized for the server's RAM:
/etc/php/<ver>/fpm/conf.d/90-cipi-opcache.ini, written when PHP is installed (setup,cipi php install) and by the migration.RAM (as the kernel counts it) memory strings files under 2 GB 128 MB 16 MB 32 531 2 GB 192 MB 24 MB 32 531 4 GB 256 MB 32 MB 65 407 8 GB 384 MB 48 MB 65 407 16 GB and more 512 MB 64 MB 130 987 - A default, under
cipi ini: the file is read before99-cipi.ini, socipi ini set opcache.memory_consumption=1024stays what it is.cipi inishows the three sizes as set by Cipi (the server's RAM) where nothing else set them — before, it showed what thephpcommand has, which is not PHP-FPM's. - A ceiling, not a reservation: the memory is taken from the RAM as scripts are cached. One cache, and one size, per PHP version. The numbers of files are the primes PHP rounds up to.
- By RAM because that is what a server can give. What a cache needs is the code it holds — apps, files, and releases: each deploy is a new folder, so its files enter the cache under new names while the old ones stay until PHP notices. Only the cache knows that, hence the two below.
- A default, under
-
cipi php opcache [<ver>] [--json]: for each PHP-FPM, what it is sized to and by whom (Cipi,cipi ini, PHP), the memory and the strings used, scripts and keys, restarts for lack of room, the share of requests found — and room left, nearly full (over 90%) or full, with thecipi ini setthat gives more room. Thephpcommand has a cache of its own, so the PHP-FPM is asked: a FastCGI request to the placeholder pool every PHP of Cipi has (www, www-data, 0600), for/usr/local/share/cipi/opcache-probe.php, which answers with numbers and never the list of the scripts. Nothing is added to nginx; no app's pool is used. -
cipi php opcache tune [<ver>]: the sizes for the RAM the server has now — after a resize. PHP-FPM is tested, then restarted; refused, the file as it was. -
cipi monitor: the checkopcache(on by default, notificationmonitor_opcache): a warning when the OPcache of a PHP version is full, with the numbers and what to run; a recovery when it has room again.
Changed
- A limit that is reduced says so.
cipi app limits --fpm-max-children=80set 50 and said nothing; so did--octane-workersover 16 and--worker-procsover 20. The limits are the same, and a warning says what was set. - Migration 5.21.0 restarts each running PHP-FPM once, to take the OPcache file — after
php-fpm -taccepted the configuration. Refused, the file is removed and PHP-FPM is left as it runs. A PHP-FPM that is stopped gets the file and is not started. cipi help phpand the completion:opcache,tune.