The short answer
Run php -v. PHP2Shell is CVE-2026-109618 and CVE-2026-109619, rated CVSS 9.2: flaws in PHP's core that can allow remote code execution without authentication. They're fixed in PHP 8.5.12, 8.4.27, 8.3.36 and 8.2.35, released on 21 October 2026. If your version is older on the same line, update with whatever installed PHP: brew upgrade php for Homebrew and Valet, herd php:update 8.4 for Laravel Herd (with your version), or a MAMP update. PHP 8.1 and older get no fix from the PHP project, so move to 8.2 or later. php.net says updating is the only complete fix.
On this page
What PHP2Shell is
PHP2Shell is the name given to two vulnerabilities in PHP's core, CVE-2026-109618 and CVE-2026-109619. php.net rates both CVSS 9.2 and says they can allow unauthenticated remote code execution: someone who can send requests to a PHP server can run code on the machine it runs on, without logging in.
| If `php -v` starts with | Update to |
|---|---|
| 8.5 | 8.5.12 or later |
| 8.4 | 8.4.27 or later |
| 8.3 | 8.3.36 or later |
| 8.2 | 8.2.35 or later. php.net says 8.2 reaches end of life on 31 December 2026. |
| 8.1 or older | No fix from the PHP project. Move to 8.2 or later. |
8.5
- Update to
- 8.5.12 or later
8.4
- Update to
- 8.4.27 or later
8.3
- Update to
- 8.3.36 or later
8.2
- Update to
- 8.2.35 or later. php.net says 8.2 reaches end of life on 31 December 2026.
8.1 or older
- Update to
- No fix from the PHP project. Move to 8.2 or later.
php.net also lists interim settings that reduce exposure to some attack paths, and says they aren't a complete fix. On a Mac used for development, updating PHP is quicker than applying them.
Check which PHP your Mac runs
macOS stopped including PHP with macOS 12, so any PHP on your Mac came from something you installed. There may be more than one:
php -v
which -a php| Path contains | Installed by | Update it with |
|---|---|---|
/opt/homebrew/ | Homebrew (Laravel Valet uses Homebrew's PHP) | brew upgrade |
Herd | Laravel Herd | herd php:update, or Herd's PHP settings |
/Applications/MAMP/ | MAMP | MAMP |
/opt/homebrew/- Installed by
- Homebrew (Laravel Valet uses Homebrew's PHP)
- Update it with
brew upgrade
Herd- Installed by
- Laravel Herd
- Update it with
herd php:update, or Herd's PHP settings
/Applications/MAMP/- Installed by
- MAMP
- Update it with
- MAMP
A local site can run a different PHP from the one in Terminal. In Herd, herd which-php shows the version for the current folder's site. In MAMP, the versions it ships are folders in /Applications/MAMP/bin/php/.
Update PHP from Homebrew (and Valet)
brew update
brew list --versions | grep -E "^php"
brew outdated | grep -E "^php"
brew upgrade phpFor a versioned formula, name it: brew upgrade php@8.3. Then restart whatever runs PHP, because a running process keeps the old version until it restarts:
# Laravel Valet
valet restart
# PHP-FPM started with brew services
brew services restart phpIf php -v still shows the old version after brew upgrade, Homebrew may not have published the new build yet. Run brew update and try again later.
Update PHP in Laravel Herd
Herd installs its own PHP builds. Herd's docs say an installed version updates to its latest patch release with herd php:update and the version number, and that its preferences window has a PHP tab where versions update with a click.
herd php:list
herd php:update 8.4MAMP
MAMP ships its own PHP builds, so brew upgrade doesn't change them. Update MAMP itself, then check the versions it includes with ls /Applications/MAMP/bin/php/ and use one at or above the fixed version for its line.
Is a PHP server on your Mac listening?
Remote code execution needs requests to reach a PHP server. To see what's listening on your Mac now:
lsof -nP -iTCP -sTCP:LISTEN | grep -Ei "php|nginx|httpd"An address of 127.0.0.1 or [::1] accepts connections from this Mac only. * or 0.0.0.0, as with php -S 0.0.0.0:8000, accepts them from other machines on your network too. Either way, update: the listing shows what is exposed right now, not what will be tomorrow.
PHP 8.1 and older
php.net says PHP 8.1 and older no longer receive updates from the PHP project. Install a supported version (brew install php installs the current one, or use Herd's PHP settings), move the project to it, and remove the old one when the project runs. If your PHP projects use Composer's certificate bundle, also see the eMudhra certificate guide.
Package Watch in iKnowMyMac
Package Watch in iKnowMyMac checks the Python packages in every environment on your Mac, including certifi, against published advisories.