Skip to content

, 8 min read

Patch PHP2Shell in Laravel Herd and XAMPP

How to update PHP for the critical PHP2Shell vulnerabilities in Laravel Herd and XAMPP, with checks, rollback steps and stopgaps.

Thick oil-paint style artwork of a lilac shield marked php with a gold rim, standing in a swirling purple storm lit orange from below.

On 21 October 2026, the PHP team released emergency fixes for two critical vulnerabilities, known together as PHP2Shell. They can let an attacker run code on a server with a single request, without logging in. Both are already being exploited.

Most of the attention is on production servers, and that’s where it matters most. But if you build PHP and Laravel apps on your own machine, your local PHP needs updating too. This guide covers the two setups I see most: Laravel Herd and XAMPP.

What PHP2Shell is

PHP2Shell is two flaws in how PHP handles web requests:

  • CVE-2026-109618: if PHP runs out of memory at the wrong moment, request data can be left half set up, and PHP may treat it as valid while cleaning up.
  • CVE-2026-109619: some internal state from one request can outlive its memory, and a later request on the same worker may use it.

Both are rated 9.2 out of 10, and PHP says every installation that serves web requests is at risk. That includes PHP-FPM, Apache with mod_php, php-cgi, FrankenPHP and LiteSpeed. Apache with mod_php is the most at risk, which is exactly how XAMPP runs PHP.

On 26 October, CISA added CVE-2026-109618 to its list of vulnerabilities known to be exploited.

The versions you need

Update to at least the release for the PHP version you use:

PHP version Fixed in
8.5 8.5.12
8.4 8.4.27
8.3 8.3.36
8.2 8.2.35
8.1 and older No official release

PHP 8.1 and older no longer get releases from the PHP team. If a project still needs one of those, upgrading the project is the real fix.

On Windows, prefer the rebuilt 8.5.12-1, 8.4.27-1, 8.3.36-1 and 8.2.35-1 builds from 26 October. They contain the same PHP, with a fix for a separate issue in a bundled library.

Why update a local machine?

A development machine is a smaller target than a server, but it’s not zero:

  • XAMPP’s Apache listens on every network interface by default, so anyone on the same café, office or university Wi-Fi may be able to reach it.
  • You test against the PHP version you’ll deploy. Staying on a vulnerable version locally makes it easy to forget the servers.
  • Old habits travel. A copied XAMPP folder or old Docker image can end up somewhere public.

Check your PHP version

Run this in a terminal. On Windows, use XAMPP Control Panel’s Shell button if php isn’t on your PATH.

php -v

In a Laravel project, this shows the PHP version the project runs on:

php artisan about

Command-line PHP and web PHP can be different builds. To see what the web server uses, open a page that calls phpinfo(), then delete the page afterwards.

Updating PHP in Laravel Herd

Herd makes this easy, because it manages its own PHP builds on macOS and Windows.

1. Update Herd first

Open Herd and check for updates from its menu. Herd 2.0.3 also fixed a problem where a failed PHP update removed that PHP version and broke its sites with 502 errors. Now the old version keeps working until the new download finishes.

2. Update PHP

You can do this in the app or from the terminal.

  • In the app: open Herd’s settings, go to the PHP tab, and select the update button next to each installed version.
  • From the terminal: list your versions, then update all of them, or one at a time:
herd php:list
herd php:update all
herd php:update 8.4

herd php:update all needs Herd 1.29 or later. On older versions, update each PHP version separately.

Update every version you have installed, not only your default. Herd can run different sites on different PHP versions, and an old one you rarely use is still served when a site is isolated to it.

3. Check it worked

php -v
herd which-php

Run herd which-php inside a project folder to see which PHP version that site uses. Then check the version number against the table above.

If an update isn’t available yet

If Herd hasn’t published the fixed build for a version you use, reduce the risk until it does:

  1. Open that version’s php.ini. Herd keeps it at ~/Library/Application Support/Herd/config/php/84/php.ini on macOS, and %USERPROFILE%\.config\herd\bin\php84\php.ini on Windows. Replace 84 with your version, for example 83.
  2. Add these lines:
session.upload_progress.enabled = Off
post_max_size = 32M
upload_max_filesize = 16M
  1. Restart Herd’s services:
herd restart

These settings reduce exposure but don’t make PHP safe. PHP’s advisory is clear that updating is the only full fix.

Updating PHP in XAMPP

XAMPP is harder, because it bundles one PHP version inside the installer. At the time of writing, ApacheFriends hasn’t released a XAMPP version with the fixed PHP, and the request to update it is still open on GitHub.

Recent XAMPP versions for Windows ship PHP 8.2, so the safest move is to replace its PHP folder with PHP 8.2.35 and stay on the same 8.2 branch. Your existing settings and extensions keep working that way.

On Windows: replace the PHP folder

  1. Stop Apache in XAMPP Control Panel, and close any terminal using XAMPP’s PHP.
  2. Download PHP 8.2.35 from windows.php.net/download. Choose the VS16 x64 Thread Safe zip, preferably the 8.2.35-1 build. It must be Thread Safe: that build includes php8apache2_4.dll, the file Apache uses to run PHP.
  3. Keep the old PHP as a backup. Rename C:\xampp\php to C:\xampp\php-old.
  4. Unzip the new PHP into a new C:\xampp\php folder.
  5. Copy your settings across. Copy php.ini from C:\xampp\php-old into C:\xampp\php. If you use PEAR, copy the pear folder too.
  6. Check Apache points to it. Open C:\xampp\apache\conf\extra\httpd-xampp.conf and confirm it loads PHP from C:/xampp/php. It includes lines like these:
LoadFile "C:/xampp/php/php8ts.dll"
LoadModule php_module "C:/xampp/php/php8apache2_4.dll"
PHPINIDir "C:/xampp/php"
  1. Start Apache again in XAMPP Control Panel.

Check it worked

Open XAMPP Control Panel’s Shell and run:

php -v

It should say PHP 8.2.35. Then open phpMyAdmin at http://localhost/phpmyadmin and one of your own projects to make sure everything still loads.

If Apache won’t start, these are the usual causes:

  • A missing VCRUNTIME140.dll: install the latest Microsoft Visual C++ Redistributable for Visual Studio 2015–2022 (x64), then try again.
  • A missing extension: compare the extension= lines in your copied php.ini with the files in C:\xampp\php\ext. XAMPP’s php.ini may enable an extension that isn’t in the official zip.
  • Something else: check C:\xampp\apache\logs\error.log for the reason.

To roll back, stop Apache, delete the new php folder and rename php-old back to php.

Stop other devices reaching XAMPP

While you’re in there, make Apache listen only on your own computer:

  1. Open C:\xampp\apache\conf\httpd.conf and change Listen 80 to:
Listen 127.0.0.1:80
  1. Do the same in C:\xampp\apache\conf\extra\httpd-ssl.conf, changing Listen 443 to Listen 127.0.0.1:443.
  2. Restart Apache.

Your sites still work at http://localhost, but other devices on your network can no longer open them.

If you can’t replace PHP yet

As with Herd, edit C:\xampp\php\php.ini, then restart Apache. php.ini already has a line for upload progress, so remove the ; at its start rather than adding a duplicate:

session.upload_progress.enabled = Off
post_max_size = 32M
upload_max_filesize = 16M

These settings are a stopgap, not a fix.

XAMPP on macOS and Linux

XAMPP’s macOS and Linux versions build PHP into the package, so you can’t swap in an official download the same way. Until ApacheFriends releases an update, apply the php.ini settings above and consider moving development to Laravel Herd on macOS, or to your Linux distribution’s PHP packages.

Projects on PHP 8.1 or older

Older XAMPP versions with PHP 7.4, 8.0 or 8.1 won’t get official fixes. The PHP team has published small source patches for those versions. They’re meant for people who build PHP themselves, and they aren’t a complete replacement for upgrading. Upgrading the project to PHP 8.2 or later is the lasting answer.

Laravel apps on servers

Local PHP is only half the job. Update your servers too, and restart PHP afterwards, because the running workers keep the old code until they restart.

  • Laravel Forge: follow Forge’s PHP security advisory for October 2026 to update PHP on each server.
  • Ubuntu or Debian servers: install your distribution’s security updates, then restart PHP-FPM, for example sudo systemctl restart php8.3-fpm.
  • Docker: rebuild your images on an updated PHP base image and redeploy.
  • Laravel Cloud: Laravel patched running applications on Cloud in place.

If you can’t update a public server straight away, the UK’s National Cyber Security Centre suggests considering taking it offline until you can.

One more setting: session upload progress

On 23 October, PHP published a further advisory, CVE-2026-115560, also about the session upload progress feature. It’s being fixed in the next regular release.

It only applies if an app changes PHP’s session serializer at runtime before starting a session. Laravel uses its own session handling rather than PHP’s native sessions, so a typical Laravel app isn’t exposed. Even so, PHP recommends session.upload_progress.enabled = Off until the fix ships, and almost no app relies on it.

Summary

  • Update PHP to 8.5.12, 8.4.27, 8.3.36 or 8.2.35 or later.
  • Herd: update Herd, run herd php:update all, then check with php -v.
  • XAMPP on Windows: replace C:\xampp\php with the PHP 8.2.35 Thread Safe build, copy your php.ini, and restart Apache.
  • Make XAMPP listen on 127.0.0.1 only.
  • Patch and restart PHP on every server.

Sources

Filed under PHP, Laravel, Security

All posts