InsightsLaravel Development
Laravel DevelopmentPHPLaravel

PHP2Shell: How to Check Your PHP Version and Fix It Today

Two critical flaws in PHP itself, rated 9.2 out of 10, let anyone run code on an unpatched server without a login. Updating WordPress does not fix this. Here is how to check your PHP version, patch it, restart it properly, and confirm you are safe.

U

Umar Farooq

System Architect & Full-Stack Engineer

October 24, 2026
10 min read
PHP2Shell: How to Check Your PHP Version and Fix It Today

Two flaws inside PHP itself now let an attacker run code on your server without any login, and the vulnerable code has been sitting in PHP since version 5.4 in 2012. If your site runs PHP, this is about you, even if your own code is perfect.

Quick Answer: PHP2Shell is two critical PHP flaws, CVE-2026-109618 and CVE-2026-109619, both rated 9.2 out of 10. The fix is to update PHP itself to 8.5.12, 8.4.27, 8.3.36 or 8.2.35 (released 21 October 2026) and restart every PHP process. Updating WordPress, Laravel or any plugin does not fix it. PHP 8.1 and older get no official fix.

What PHP2Shell actually is

PHP2Shell is not a plugin bug and not a theme bug. It is two memory bugs in the PHP interpreter, the engine that runs before your WordPress, Laravel or custom code even starts. That is why no application update can close it.


CVE-2026-109618

CVE-2026-109619

What goes wrong

PHP runs out of memory while handling a request, cleanup then trusts half-built request data

Stale request-owned global state is reused by a later request on the same worker

Login needed

No

No

Severity

Critical, CVSS v4.0 9.2 (NVD lists v3.1 9.8)

Critical, CVSS v4.0 9.2 (NVD lists v3.1 9.8)

Fixed in

PHP 8.5.12, 8.4.27, 8.3.36, 8.2.35

PHP 8.5.12, 8.4.27, 8.3.36, 8.2.35

Every setup that serves web requests through PHP is in scope: PHP-FPM, Apache with mod_php, php-cgi, FrankenPHP and LiteSpeed. The PHP project rates mod_php the highest risk, because an unauthenticated request can trigger the attack before any application code runs. Exploitation attempts were already observed on 17 October 2026, four days before public disclosure, and working proof-of-concept code is now circulating, according to CERT-EU.

I saw how thin the margin is this week. On 22 October I checked a client website I look after, and its server was running PHP 8.2.34, exactly one patch release below the fix. The site's own code was fine. The server was one small version number away from safe, and until the hosting provider upgraded it to 8.2.35 the next day, that site was exposed to anyone who sent it the wrong request. Context, action, result: check the runtime, not just the app; one patch level decided the whole risk.

Step 1: Find the PHP version that actually serves your site

Do not guess, and do not trust the version your CLI shows. The command line, PHP-FPM and Apache can each run a different PHP build on the same server. Check the one answering web requests:

  • WordPress: Dashboard, Tools, Site Health, Info, Server. It lists the PHP version serving the site.

  • Laravel / custom PHP: add a temporary page that calls phpinfo(), load it in the browser, read the version at the top, then delete the page immediately. Never leave a phpinfo page online.

  • cPanel / Plesk: open the PHP Selector or PHP Settings for the domain. It shows the version and lets you switch where the host allows it.

  • Server shell: run php -v for the CLI build, then check your FPM pool or Apache config for the build that serves traffic.

# CLI version (may differ from the web-serving build)
php -v

# Which PHP-FPM pools are running, and their versions
systemctl list-units "php*-fpm*" --no-pager

# Confirm what the web server reports after patching
curl -sI https://yourdomain.com | grep -i x-powered-by

Step 2: Update PHP to a fixed release

Update within your current branch. The fixed releases, all published 21 October 2026, are:

Your branch

Update to

PHP 8.5

8.5.12

PHP 8.4

8.4.27

PHP 8.3

8.3.36

PHP 8.2

8.2.35

PHP 8.1 and older

No official fix. Upgrade (Step 5)

On Linux servers, install your distribution's security update; distributions received the patches early and some backport them without changing the version string, so confirm with your host that the package changelog names both CVE-2026-109618 and CVE-2026-109619. On shared hosting, the host applies the update: check their status page today, and open a ticket if the fixed release is not offered yet. On Docker, rebuild your images from the patched base image and redeploy. An old container keeps the old PHP forever.

Step 3: Restart everything that runs PHP

Installing the package is not enough. Running processes keep the old, vulnerable code in memory until they restart. After updating, restart every PHP worker you have:

  • PHP-FPM pools for every version in use

  • Apache (required for mod_php), or LiteSpeed

  • Long-running workers: Laravel queue workers, Octane, RoadRunner, Swoole, Horizon

Then repeat the Step 1 check in the browser and confirm the new version is the one answering requests. Skipping the restart is the most common reason a "patched" server stays vulnerable.

Step 4: If you are on PHP 8.1 or older, you must upgrade

There is no official PHP release that fixes 8.1, 8.0, 7.4 or anything older, and there never will be. The PHP security team published minimal source backports for 7.4, 8.0 and 8.1 for people who compile PHP themselves, and some Linux distributions and long-term-support vendors ship patched packages. If your host offers neither, the only real fix is upgrading to a supported branch.

Plan the jump properly: test your themes, plugins and custom code on PHP 8.3 or 8.4 in staging first, fix the removed functions and deprecations, then switch production. I have done this exact work at scale this year, migrating legacy PHP 5.x applications to PHP 8.3, and the pattern is always the same: the upgrade is a few days of focused work, while a breach is months. One more reason to move now: even PHP 8.2 leaves security support on 31 December 2026, so if you are upgrading anyway, target 8.4.

Step 5: If you cannot patch today, reduce the exposure honestly

These steps lower risk on the known attack paths. None of them is a complete fix, and the PHP project says so itself:

  • Set session.upload_progress.enabled = 0 in php.ini and restart PHP. WordPress does not use this feature, and PHP recommends turning it off if you do not need it.

  • Put the site behind a web application firewall with current managed rules set to block, not just log. Cloudflare published PHP2Shell rules across its plans.

  • Ask your admin to review memory_limit and upload and POST size limits against the PHP advisory.

  • If you run a high-value site and cannot patch or upgrade within a day, do what the UK NCSC and the US NSA advised this week: take it offline until you can. Governments chose downtime over exposure. That tells you the real risk level.

Step 6: After patching, check whether you were already hit

Attacks started on 17 October, before the patch existed, so a patched server can still hold a backdoor planted last week. Review your logs from 17 October 2026 onward for:

  • Large or malformed multipart POST requests and PHP out-of-memory errors

  • Unusually long or malformed PHPSESSID cookies

  • New or recently modified PHP files in your web root that you do not recognise

  • Unknown admin users, and PHP workers crashing or restarting in loops

The second flaw can expose memory contents, so if your server was reachable and unpatched during that window, rotate the secrets that matter: admin passwords, database passwords, API keys and payment gateway keys. It is an hour of work against a worst case you do not want.

Summary & Production Takeaways

PHP2Shell is a server problem, not an app problem: two 9.2-rated flaws in PHP itself, exploited before disclosure, fixed only by updating PHP to 8.5.12, 8.4.27, 8.3.36 or 8.2.35 and restarting every worker. Check the version that serves your site, patch today, verify in the browser, and if you are stuck on PHP 8.1 or older, treat the upgrade as urgent work, not a someday task.

If you want this handled for you: I check, patch and upgrade PHP servers for WordPress, Laravel, Drupal and custom PHP sites, including full upgrades from PHP 5.x, 7.x and 8.1 to 8.3 or 8.4 with compatibility fixes and post-patch verification. Start with a free PHP version and vulnerability check at itsumarfarooq.com/connect, email contact@itsumarfarooq.com, or WhatsApp +966 59 457 6805. Tell me your current PHP version and I will tell you honestly whether you are exposed. More on my services.

FAQs

Does updating WordPress fix PHP2Shell?

No. The flaws are inside PHP, underneath WordPress. Core, plugin and theme updates cannot touch them. Only updating the PHP version on the server, then restarting PHP, closes the hole.

How do I know if my website is affected?

Check the PHP version that serves your site (WordPress: Tools, Site Health, Info, Server). Anything below 8.2.35, 8.3.36, 8.4.27 or 8.5.12 on its branch is vulnerable, and every version of PHP 8.1 or older has no official fix at all.

My host says the version number did not change. Am I safe?

Maybe. Some Linux distributions backport the fix into their own packages without changing the version string. Ask the host to confirm in writing that their package changelog covers both CVE-2026-109618 and CVE-2026-109619. If they cannot confirm it, treat the site as unpatched.

Is a firewall enough protection?

No. A good WAF blocks the known attack paths and buys you time, but proof-of-concept code is circulating and attackers adapt payloads. The PHP project is explicit: updating PHP is the only complete fix.

My site runs PHP 7.4 and works fine. Do I really need to upgrade?

Yes. Your branch receives no official security releases, and this flaw's code has existed since PHP 5.4. "It still works" and "it is safe" are different statements. Upgrade to PHP 8.3 or 8.4 with proper compatibility testing.


Sources: PHP security releases and advisories, 21 Oct 2026 (php.net); NCSC-NL PHP2Shell operational repository (github.com/NCSC-NL/php2shell); NVD entries for CVE-2026-109618 and CVE-2026-109619; CERT-EU advisory; Wiz Research disclosure.

Umar Farooq - Full-Stack & AI Engineer

Umar Farooq

Author & Consultant

Specializes in Laravel, Next.js, and AI products. 5+ years enterprise experience with 80+ delivered platforms and full source code ownership.

Did you find this architecture breakdown useful?