Audit your servers, containers, and hosts to find every PHP version and web SAPI, and check package changelogs for backported security fixes.
Before you can patch PHP2Shell (CVE-2026-109618 and CVE-2026-109619), you need to know every place PHP runs in your environment. A single server can have multiple PHP versions installed at the same time. The version that responds in your terminal is not always the version serving live web traffic. In this lesson, you will build a complete inventory of your PHP installations, check both command-line and web Server Application Programming Interfaces (SAPIs), and verify whether Linux distribution packages contain backported fixes.
Previous lesson: PHP2Shell Explained: CVE-2026-109618 and CVE-2026-109619 | Next lesson: Patch PHP: Apply the October 2026 PHP Security Update
You cannot patch a server you forgot existed. Start by listing every system that might run PHP, even if it is not a primary production web server.
Take the example company for this course, Brightline Logistics. A quick check of their infrastructure reveals three main applications:
brightline-www: the public WordPress marketing site, running on Ubuntu 22.04 with Apache and mod_php on the distribution's PHP 8.1 packages.brightline-portal: the customer portal, a Laravel application running on PHP 8.3 with PHP FastCGI Process Manager (PHP-FPM) and nginx inside Docker containers built from the official php:8.3-fpm image.brightline-invoicing: a legacy internal invoicing application on PHP 7.4, running on a Red Hat Enterprise Linux (RHEL) 8 virtual machine.When you build your own list, look beyond your main application servers. Check these common blind spots:
Record five facts for each item you find: the application name, the owner, the host or container image, the PHP version, and the active web SAPI.
Running php -v in a shell only tells you the version of the Command Line Interface (CLI) binary. It does not tell you which PHP version or SAPI handles incoming HTTP requests.
Think of a server with multiple PHP packages like a building with a front reception desk and a back loading dock. Checking php -v only checks who is working at the loading dock, while all your visitors walk through the front reception desk.
On Ubuntu and Debian servers such as brightline-www, run these read-only commands to inspect the CLI, the configuration files, the PHP-FPM binary, the loaded Apache modules, and all installed PHP packages:
bashCopy
On brightline-www, apachectl -M returns php_module (shared), and dpkg -l shows libapache2-mod-php8.1. Because the PHP advisory rates mod_php as the highest risk SAPI for PHP2Shell, brightline-www goes to the top of the patching queue.
On RHEL, Rocky Linux, or AlmaLinux servers such as brightline-invoicing, use the RPM Package Manager (rpm) to find every installed PHP package:
bashCopy
Also check which services are actively running on the host so you do not miss an unexpected SAPI such as FrankenPHP, LiteSpeed, or an older PHP-FPM pool:
bashCopy
Common Mistake: Never leave a phpinfo() file on a public website to check your web SAPI. It exposes sensitive environment variables, file paths, and configuration details to anyone who finds it. If you must create a phpinfo() script to verify how the web server runs PHP, restrict access to your own IP address in the web server configuration and delete the file immediately after checking.
Containers do not share the host operating system's PHP packages. Running php -v on the Docker host will not tell you what brightline-portal is running inside its container.
List your running containers and run php -v and php-fpm -v inside each PHP container:
bashCopy
On brightline-portal, docker ps shows the image tag php:8.3-fpm. Inside the container, php-fpm -v reports PHP 8.3.12 (fpm-fcgi). Because the PHP2Shell fix for the 8.3 branch arrived in 8.3.36, this container is vulnerable and needs a base image update.
Pro Tip: Check your image registries and Kubernetes manifests too. A container that scales down to zero during quiet hours will not appear in docker ps, but it will launch with an unpatched image as soon as traffic spikes.
For managed hosting or Platform-as-a-Service (PaaS) environments where you do not have root shell access, check your control panel or run php -v in the provider's web terminal if available. Because managed platforms often apply custom patches, you should also check your hosting provider's security bulletin for CVE-2026-109618 and CVE-2026-109619.
What happens if you run php -v on Ubuntu 22.04, see a version that starts with PHP 8.1.2-1ubuntu2, and compare that to the upstream fixed versions (8.2.35, 8.3.36, 8.4.27, and 8.5.12)? You might think there is no fix available for your server.
Linux distributions such as Ubuntu, Debian, and RHEL rarely upgrade you to a new major or minor PHP version during the life of an operating system release. Instead, their security teams take the specific code fix from the PHP project and backport it into the older version they ship. The main version number stays 8.1.2, while the distribution suffix at the end increases.
Here is a real example. On Ubuntu 24.04, the patched package is 8.3.6-0ubuntu0.24.04.13. It still reports PHP 8.3.6, far below the upstream fix in 8.3.36, yet its changelog lists both CVE-2026-109618 and CVE-2026-109619.
Because php -v shows the base version number, you cannot rely on it alone to tell if a distribution package is patched. You must check your operating system vendor's security notice or search the package changelog for the Common Vulnerabilities and Exposures (CVE) identifiers.
On Debian or Ubuntu systems such as brightline-www, search the changelog of the installed package. Read the local file, not apt changelog, because apt changelog shows the newest version available in the repository, which may not be the version you have installed:
bashCopy
On RHEL, Rocky Linux, or AlmaLinux systems such as brightline-invoicing, query the local RPM changelog:
bashCopy
How do you read the result?
CVE-2026-109618 and CVE-2026-109619, the installed package includes the backported fixes (though you still must confirm the web server or PHP-FPM service was restarted after the package was installed).Once you have inspected Brightline Logistics' three systems, you can organize them into a clear response order:
brightline-www): Internet-facing Ubuntu 22.04 server running Apache mod_php on PHP 8.1. The changelog search returned no matches for the CVEs. Because it is public and uses mod_php (the highest risk SAPI), you must patch or mitigate this first.brightline-portal): Internet-facing Docker containers running php:8.3-fpm (version 8.3.12) behind nginx. PHP-FPM is affected by PHP2Shell, and the container version is older than the fixed 8.3.36 release.brightline-invoicing): Internal RHEL 8 virtual machine running PHP 7.4 with PHP-FPM. It is not exposed to the public internet, which lowers immediate risk, but PHP 7.4 is end-of-life upstream and will need either a vendor patch, temporary mitigation, or an upgrade plan.Run this audit on one of your own Linux hosts or test virtual machines to confirm the installed PHP versions, active SAPIs, and patch status:
php -v to record the CLI PHP version.systemctl list-units --type=service --state=running | grep -E 'php|apache|httpd' or docker ps.dpkg -l | grep -E '^ii\s+(php|libapache2-mod-php)' (on Debian/Ubuntu) or rpm -qa | grep -i '^php' (on RHEL family systems).zgrep on /usr/share/doc/php8.1-common/changelog.Debian.gz, adjusted for your PHP version, or rpm -q --changelog php-common) for your installed package and check whether CVE-2026-109618 and CVE-2026-109619 appear in the output.In the next lesson, Patch PHP: Apply the October 2026 PHP Security Update, you will apply the fixed PHP packages and container images, restart every worker process, and verify that the update is active.
Was this lesson helpful?