
PHP2Shell and Your PHP Version: What to Update, and What to Do If You Can't
Full Stack Developer
On October 21, the PHP project released fixes for two critical flaws, CVE-2026-109618 and CVE-2026-109619. Together they are now called PHP2Shell. Both let an attacker run code on a web server without logging in, and attacks started before the fixes were out.
The fix exists. It protects a server only after someone installs it.
That gap, between a release on php.net and a release running on your server, is what this post is about. PHP2Shell is the urgent case, but the same steps apply to every PHP site, every year.
How to Check Your PHP Version
Every decision below depends on the version number, so start there.
- A server you control. Run
php -von the command line, then check the version the web server reports too, because the two can differ. Aphpinfo()page shows it, so delete that page as soon as you have read it. - Shared hosting. Look in the hosting control panel, usually under a PHP settings or PHP version menu. One account can run different versions on different sites, so check each one.
- WordPress. Open Tools, then Site Health, then the Info tab, and look under Server. The PHP version is listed there without any server access.
- From outside, in a browser. Some servers name the PHP version in the
X-Powered-Byresponse header, which the browser's developer tools show on the Network tab. Many servers hide that header, so a missing one proves nothing. - A device with a web admin panel. Search the vendor's security advisories for PHP2Shell. If the device is affected, the fix comes as a firmware update from the vendor, not from php.net.
If You Run 8.2, 8.3, 8.4 or 8.5
Update to 8.2.35, 8.3.36, 8.4.27 or 8.5.12. These are the releases that fix both flaws. A Linux distribution or hosting panel package can carry the fix and keep its old version number, so also check the vendor's notice for CVE-2026-109618 and CVE-2026-109619. php.net lists every PHP installation that serves web requests as at risk, including PHP-FPM, Apache with mod_php, php-cgi, FrankenPHP and LiteSpeed, and it rates mod_php highest, because an unauthenticated request can trigger the attack before any application code runs.
Then restart every PHP worker, including FrankenPHP and LiteSpeed processes if you use them. PHP-FPM and Apache workers that are already running keep the old code in memory, so a server can have the new package installed and still serve requests with the old one. Check the version again from the web side after the restart, not only from the command line.
After the update, set session.upload_progress.enabled=0 in php.ini or the PHP-FPM pool configuration, restart every worker, and leave it off until the next PHP release. It also covers CVE-2026-115560, which php.net describes in a separate entry and which the October releases do not fix. That flaw matters only when an application switches session.serialize_handler to php with ini_set() before session_start(). ini_set() and .user.ini are not enough for this setting.
If you run 8.2, note one more date. Security support for 8.2 ends on December 31, 2026. After that, the next flaw like PHP2Shell gets no 8.2 release at all.
If You Run 7.4, 8.0 or 8.1: Patches and Backports
This is the hard case.
The PHP project no longer makes releases for these branches. For PHP2Shell, its security team published minimal source backports for 7.4, 8.0 and 8.1. Those are code changes for people who compile PHP themselves, not a package you can install.
That leaves three routes.
- Ask your vendor. Some Linux distributions, hosting panels and long term support vendors ship their own backported fixes, and php.net points users of 8.1 and older to them. A vendor package can keep its old version number and still carry the fix, so ask your host or vendor whether your exact PHP build is fixed for CVE-2026-109618 and CVE-2026-109619, and get the answer in writing.
- Build from the backport. If you already compile PHP yourself, the security team's backports let you patch without changing versions. You then own every future fix for that branch as well.
- Upgrade to a supported branch. Move the application to 8.4 or 8.5. It takes real engineering work, and it is the only route that does not repeat with the next flaw.
Most of that work sits in the application code. Code written for 7.4 often fails on 8.x: some functions were removed in PHP 8.0, many warnings became errors, and the libraries a site depends on may need their own upgrades first.
A backport fixes PHP2Shell on 7.4. Only an upgrade gets you off 7.4.
So start the upgrade plan now, and protect the server while it runs.
PHP2Shell Mitigations Until You Can Update
php.net is clear that no partial measure makes an installation safe. Its advisory lists steps that narrow specific attack paths until the update is done.
- Turn off session upload progress. Set
session.upload_progress.enabled=0inphp.inior the PHP-FPM pool configuration, then restart every worker. php.net saysini_set()and.user.iniare not enough for this setting and that it blocks the confirmed session paths but not other variants, and the same setting also covers CVE-2026-115560, which php.net describes in a separate entry and which the October releases do not fix yet. - Remove the PHP memory limit. Set
memory_limit=-1withphp_admin_valuein the PHP-FPM pool or the Apache configuration, so an application cannot override it, and check that no pool, directory or application setting puts a finite limit back; php.net lists this first for CVE-2026-109618 and warns that an allocation failure can still reach the flaw. With no limit, one runaway request can use all host memory, so pair it with the container or cgroup limit below. - Limit request size. Set
post_max_sizeto8Mif the site takes no uploads, or32Mif it does, and keepupload_max_filesizebelow it. This narrows one path into CVE-2026-109618. - Do not use
RLIMIT_ASorRLIMIT_DATA. php.net warns that these limits can cause the same allocation failure. Use a container or cgroup limit instead, preferably one that stops only the affected worker. - On PHP 8.5, turn off fatal error backtraces. Set
fatal_error_backtraces=0and restart every worker. php.net says this blocks the confirmed fatal backtrace path only. - Put a web application firewall in front. Cloudflare published firewall rules for PHP2Shell, so check whether your own provider did too. A rule buys time, and the update is still due.
The full list, with the conditions for each step, is in the php.net security advisory.
Check That Nobody Got In First
Attackers tried PHP2Shell before the fixes were public. Amazon's threat team recorded an attempt on October 17, four days before the release, and says a compromise may predate the advisory (Amazon Security Blog). So after you update, look for signs that someone was already there.
- New PHP files where uploads live. Look for
.phpfiles modified since October 17 in upload folders, which should hold only images, and compare cache and temporary folders against what the application itself writes there. A web shell can fake its modified time, so a clean result here proves nothing. - Scheduled tasks and accounts. Check cron entries and admin users for anything that nobody on the team remembers adding. A new entry is a common way back in after the original hole is closed.
- Outbound connections. Look in firewall or server logs for traffic from the web server to addresses you do not recognize. A web server rarely needs to start connections of its own.
If you find something, do not just delete the file. Rebuild the server from a known good state, then change every password and key it held.
The Same Questions, Every Year
PHP releases a new branch about once a year, near the end of the year. Each branch gets two years of active support and two more years of security fixes. A site that never changes its PHP version is out of support four years after that version shipped, whatever its own code does.

A security release is a task for a named person, on a date in the calendar. Photo: Derrick Coetzee at NERSC, CC0, via Wikimedia Commons.
Three questions are worth answering well before that date.
- Who updates PHP on this server? It should be a specific person. If the answer is "the vendor" or "IT" and nobody knows when they last did it, nobody is doing it.
- When does our version lose security support? php.net lists the date on its supported versions page. Put it in the calendar on the day you go live.
- What breaks when we upgrade? Try the next version on a test copy a few months ahead. Finding out then costs far less than finding out in an emergency.
If you are in Malaysia or Singapore and looking for someone to maintain your PHP servers, we might be able to help. Here is how we work.
Contact: contact@d8s.co.jp
Hero photo by Victor Grigas, CC BY-SA 3.0, cropped, via Wikimedia Commons (https://commons.wikimedia.org/wiki/File:Wikimedia_Foundation_Servers-8055_22.jpg)
