Responding to a critical PHP security release (and what to do with an unpatchable server)
phpsecuritycvepatchingdnfappstreamremicentos-7end-of-lifeapache
How a pre-announced critical PHP release was handled across three machines: a supported server that could be patched the same day, an end-of-life server that could not be patched at all, and a desktop that did not matter. The case was "PHP2Shell" (CVE-2026-109618/109619), two unauthenticated remote-code-execution flaws fixed on 2026-10-21 in PHP 8.5.12, 8.4.27, 8.3.36 and 8.2.35, with no workaround. The general lesson: know where your PHP packages come from before the advisory lands, and when a machine cannot be patched, contain it instead of hoping.
Before the release
- Treat every install as affected until the advisory says otherwise. Early leaks and scores that circulate before release are often wrong.
- Rank machines by exposure. An internet-facing server running public PHP sites matters; a desktop whose PHP dev server listens only on 127.0.0.1 is low priority.
- Check how far behind you already are:
dnf check-update 'php*'. The Alma 9 server was three rebases behind (8.3.29 while 8.3.33 waited in the repo). Applying pending updates first is low-risk within a minor series and shrinks the gap.
Where RHEL-family PHP comes from
- On Alma/Rocky/RHEL 9,
php:8.3from the AppStream module is Red Hat's build: periodic rebases to upstream releases, not Remi's repo. It can lag upstream by days or weeks for routine releases. For PHP2Shell, Red Hat shipped the 8.3.36 rebase the same day, so a plain update went straight from 8.3.29 to 8.3.36. -
If the distro build lags on a real RCE, the fast option is Remi's modular repo (
php:remi-8.3), which usually ships within hours. It changes where all PHP packages come from, so it is a deliberate decision, not a reflex. -
"Latest package" is not "fixed". For a later, lower-severity bug (PHP's uppercase-S TLS downgrade (CVE-2026-128064) and proving it on the wire) the only update on offer was a rebuild of the same vulnerable 8.3.36. Read the package changelog (
rpm -q --changelog php-common | head) and, where it is cheap, test the behavior itself. While waiting, audit whether any code can reach the bug at all; that decides between switching repos and simply waiting.
Patching (supported server)
dnf update 'php*'
systemctl restart php-fpm httpd
php -v
Then run the smoke tests and curl every vhost for a 200. Restart php-fpm explicitly; it is separate from httpd on Alma 9 (Setting up an Alma Linux 9 LAMP server).
Containing an unpatchable end-of-life server
The old CentOS 7.7 server ran PHP 7.3.14 under mod_php. Nothing could be updated: CentOS 7 mirrors
return 404, Remi's el7 repos are frozen, PHP no longer patches 7.3, and reports said the flaws went
back to PHP 5.4. Building PHP 8 by hand on it would break the old apps. So PHP was switched off:
1. Disable the module: rename /etc/httpd/conf.modules.d/15-php.conf to
15-php.conf.disabled-<reason> and apachectl graceful (no dropped connections).
2. Block PHP source at the same time, or Apache serves .php files as plain text and exposes
database credentials. A late-loading conf.d/zz-php-disabled.conf:
apache
<FilesMatch "\.(php|php[0-9]|phar|phtml|inc)$">
Require all denied
</FilesMatch>
Verify a known config file (e.g. a mysql_conf.php) now returns 403.
3. Check for an existing compromise: PHP files modified recently (find -name '*.php'
-mtime -60), webshells, and whether suspicious 200s in the logs are real files or a
framework's catch-all route.
4. List what breaks: check which domains still resolve to the old box (dig @1.1.1.1), and
which of them were PHP. Static sites keep serving; PHP sites go to 403; directories whose
.htaccess uses php_value turn into 500s.
5. Write down the revert (rename the conf back, delete the deny file, graceful) and the real fix:
move live sites to the patched server (Moving a website to a new server without downtime) or retire them.
Gotchas
- Without the deny block, "PHP disabled" is worse than vulnerable: every config file becomes downloadable.
- An old server that nobody deploys to still runs Apache and still serves whatever DNS points at it. Inventory it before every security event, not during.
See also
- Setting up an Alma Linux 9 LAMP server
- Apache vhost gotchas (icons alias, manifests, SPA fallback, redirects)
- PHP 7 to 8 upgrade breakage and other PHP traps
- PHP's uppercase-S TLS downgrade (CVE-2026-128064) and proving it on the wire
- Moving a website to a new server without downtime