On October 21, 2026, the PHP project published emergency versions of PHP. They fix two flaws that let a stranger run their own code on a web server: no password, no account. In the project's own words, the attack is triggered "before any application code runs". The security world calls the pair PHP2Shell.

If your site or application runs PHP 8.2 or newer, the fix is an update and a restart. If it runs PHP 5, PHP 7, 8.0 or 8.1, there is no update to install: the PHP project no longer releases those versions. This article is for that second group.

What PHP2Shell is

Two bugs in PHP itself, not in your application: CVE-2026-109618 and CVE-2026-109619. The first is triggered by a form request, the kind used to upload files, built to make PHP run out of memory. PHP stops halfway, leaves data half-built, and its own cleanup then reads that data. The second lets data from one request survive into the next request handled by the same PHP process. Both are rated critical, 9.2 out of 10, and both end the same way: the attacker's code runs on your server.

Three things make it worse than the usual security notice:

  • No login is needed. The request can come from anyone on the internet.
  • The quality of your code does not matter. The flaw is reached before your application starts. A well-written application on an unpatched PHP is as exposed as a bad one.
  • Default settings are enough. The PHP team validated a complete attack against PHP running inside Apache with default settings. The second flaw goes through session upload progress, a feature that is on by default and that your application does not even have to use.

Attackers did not wait. F5 Labs recorded the first PHP2Shell probes on October 21 at 08:36 UTC, more than five hours before the fix was published, and thousands of attempts in the hours that followed.

Which versions got the fix

PHP versionPHP2Shell fixSecurity fixes until
PHP 8.58.5.12December 31, 2029
PHP 8.48.4.27December 31, 2028
PHP 8.38.3.36December 31, 2027
PHP 8.28.2.35December 31, 2026
PHP 8.1, 8.0 and 7.4No release. A source patch only, for whoever compiles PHPEnded
PHP 7.3 and older, PHP 5 includedNothing from the PHP projectEnded

Two lines of that table deserve a second look. PHP 8.1: the PHP security team published a minimal source patch for 7.4, 8.0 and 8.1, but no release. Unless your host or your Linux distribution packaged it, you do not have it. PHP 8.2: it got its fix, and its security support ends on December 31, 2026. After that date it is on the unsupported list with the others.

Is PHP 5 affected? The official advisories list PHP 8.2 to 8.5, the only versions still followed. The source patches for 7.4, 8.0 and 8.1 show the same bugs are there too. Several security write-ups say they go back much further; the PHP project has published nothing for those versions, one way or the other. I would not bet a business on PHP 5.6 being the exception.

On an old version? What to do this week

  1. Find out which PHP you run. It is in your hosting panel, or your host can tell you. Check every site: two sites on the same server can run two different versions.
  2. Ask your host if their PHP carries the PHP2Shell patch. Some hosts and Linux distributions maintain patched builds of old versions. Their PHP 7.4 is not the PHP 7.4 of 2022. Get the answer in writing.
  3. Restart PHP after any update. The processes already running keep the old code until they are restarted.
  4. Turn off session upload progress if you do not use it. One line in the PHP configuration: session.upload_progress.enabled=0. The advisory suggests it even on a patched server.
  5. Read the logs. The advisory says to look in the web server and PHP logs for repeated warnings, fatal errors and "Maximum execution time exceeded" early in a request. It also says a clean log proves nothing.
  6. Look for what may already be inside. A patch closes the door; it does not remove what came through it. PHP files nobody recognizes, a new administrator account, a scheduled task that was not there. Take a backup you know how to restore before touching anything.

All of that buys time. It does not settle the question: a PHP 7.4 patched by a host is still a version for which the next flaw gets no official fix.

Which version to move to

Many migration plans written a few years ago say "PHP 8.1 or later". At the end of 2026 that floor is too low: PHP 8.1 has been out of support since December 31, 2025, and 8.2 follows on December 31, 2026. Today I aim for PHP 8.4, which gets security fixes until the end of 2028, or 8.3 (end of 2027) when a library the application depends on is not ready for 8.4. The work is nearly the same whichever you choose. The hard step is getting to PHP 8 at all; moving from one PHP 8 to the next is small.

What breaks between old PHP and PHP 8

PHP removed what it had been warning about for years, and it became strict about code it used to let pass. In an application written for PHP 5, the list usually looks like this:

  • The database calls. The mysql_* functions were removed in PHP 7.0. Every query moves to mysqli or PDO. It is the right moment to use prepared statements, which closes SQL injection at the same time.
  • Removed functions. ereg, split, each, create_function, magic quotes, the mcrypt extension. Each has a replacement. Encryption written with mcrypt has to be redone with care, so that the old data can still be read.
  • Errors that used to be silent. A variable or an array key that does not exist now raises a warning. A built-in function that receives the wrong type of value now stops the page instead of quietly returning nothing.
  • Comparisons. In PHP 8, 0 == "abc" is false. Before, it was true. Code that relied on it changes behaviour with no error message at all, which is why it has to be searched for, not waited for.
  • Old-style classes. A method named after its class is no longer a constructor in PHP 8. Properties created on the fly are deprecated since PHP 8.2.
  • Libraries and the framework. An old framework or a library that does not run on PHP 8 has to be upgraded or replaced. It is often the largest part of the job.
  • The server around it. An old PHP usually sits on an old operating system, an old database and old encryption settings. They move together.

How a migration goes

  1. Inventory. The code, the database, the server, the scheduled jobs, the PHP extensions and the libraries, written down.
  2. Version control and a copy. The code goes under version control and a copy of the application runs apart from production, with a copy of the data. Nothing is tried on the live site.
  3. A backup that has been restored once. Before the first change.
  4. An automated scan. Tools such as PHPCompatibility, PHPStan and Rector read all the code and list every line that will not run on the target version. Rector rewrites a good share of the mechanical changes itself. This is what gives the size of the job before it starts.
  5. Fix in steps. For a large application: PHP 5.6 to 7.4, then 7.4 to 8, with every error logged on the copy. Each step is tested before the next one.
  6. Test what makes the money. Login, order, invoice, report, export, with the people who use them every day.
  7. Switch with a way back. The old version stays ready to be put back, and the logs are watched in the days that follow.

None of this is a rewrite. The application keeps doing what it does; it does it on a PHP that still gets fixed. What it costs depends on the amount of code, the age of the framework and the number of libraries to replace, which is why I read the code first and quote after: the scan gives a count, not a guess. This is the work I do when I take over an old PHP application.

Sources