Patch PHP2Shell in four steps.
Pick your setup and copy each step. It takes about ten minutes.
-
Check which PHP you run
Servers often have more than one PHP installed. The second command lists them all. Anything older than 8.5.12, 8.4.27, 8.3.36 or 8.2.35 needs updating.
Terminal$ php -v $ ls /etc/php/Ubuntu and Debian often keep the old version number (like 8.3.6) even after the fix is applied. Step 4 checks for the fix itself.
-
Update PHP
Upgrades every installed PHP package, from your distribution or from the ondrej/php PPA, and nothing else.
Terminal$ sudo apt update $ sudo apt install --only-upgrade $(dpkg-query -W -f='${binary:Package}\n' 'php*' 'libapache2-mod-php*' 2>/dev/null) -
Restart every PHP worker
The fix only takes effect once PHP restarts. Restart PHP-FPM, and Apache too if you use it.
Terminal$ sudo systemctl restart 'php*-fpm' $ sudo systemctl restart apache2 # if you use Apache -
Confirm the fix
Look for the PHP2Shell fix in the package changelog. Swap
8.3for your version. A number above 0 means you’re patched.Run our website check againTerminal$ zgrep -c CVE-2026-109618 /usr/share/doc/php8.3-common/changelog.Debian.gz
Can’t update today?
These shrink the risk but don’t remove it. Add them to your server or pool config, then restart PHP. Better still, take the server offline or behind a VPN until it’s patched.
; Stopgaps only. Updating PHP is the real fix.
session.upload_progress.enabled = 0
post_max_size = 8M ; 32M if you accept uploads
upload_max_filesize = 6M ; keep below post_max_size
memory_limit = -1 ; watch server memory
fatal_error_backtraces = 0 ; PHP 8.5 only; In each pool, e.g. /etc/php/8.3/fpm/pool.d/www.conf
php_admin_value[session.upload_progress.enabled] = 0
php_admin_value[post_max_size] = 8M
php_admin_value[upload_max_filesize] = 6M
php_admin_value[memory_limit] = -1ini_set() and .user.ini are
too late to help. Don’t cap memory with ulimit; it can trigger the flaw.
On PHP 8.1 or older?
There’s no official release with the fix for 8.1 and older. The real fix is moving to PHP 8.3 or newer, which is what we do.
How we modernize old PHPRather we handled it?
If you’ve asked for an assessment, we’re already on it.
Get help patchingdeveloper@hpasoftware.com