PHP 8.5.12 is the newest release not affected by PHP2Shell (CVE-2026-109618, CVE-2026-109619). If you'd rather stay on your current branch, these releases are also fixed:
Uses Ondřej Surý's PPA. Pick the block that matches how PHP is wired into your web server.
sudo add-apt-repository -y ppa:ondrej/php sudo apt update sudo apt install -y php8.5 php8.5-cli php8.5-common php8.5-curl php8.5-gd \ php8.5-mbstring php8.5-mysql php8.5-xml php8.5-zip
Apache with mod_php (highest risk): switch the module over.
sudo apt install -y libapache2-mod-php8.5 sudo a2dismod php8.1 php8.2 php8.3 php8.4 2>/dev/null sudo a2enmod php8.5 sudo systemctl restart apache2
PHP-FPM (nginx or Apache with proxy_fcgi): point your pool and web server at the 8.5 socket, /run/php/php8.5-fpm.sock.
sudo apt install -y php8.5-fpm sudo systemctl enable --now php8.5-fpm # then update fastcgi_pass / SetHandler to /run/php/php8.5-fpm.sock and reload the web server
Make the command line use 8.5 too:
sudo update-alternatives --set php /usr/bin/php8.5
Can't change branch today? Staying on 8.2, 8.3 or 8.4 from the same PPA also fixes it: sudo apt update && sudo apt install --only-upgrade 'php8.3*' libapache2-mod-php8.3 (swap in your version), then restart Apache or PHP-FPM.
Using Ubuntu's own php packages instead of the PPA? Ubuntu fixed them in USN-8948-1/-2 without changing the upstream version number: 22.04 8.1.2-1ubuntu2.28, 24.04 8.3.6-0ubuntu0.24.04.13, 26.04 8.5.4-0ubuntu1.5, 26.10 8.5.9-0ubuntu2.1. 14.04 to 20.04 are fixed through Ubuntu Pro (ESM). Run sudo apt update && sudo apt install --only-upgrade '?name(^php[0-9.]+$)', then restart PHP. [source]
The patch takes effect only once every running PHP process has been replaced. Restart whatever runs PHP for you:
# Apache with mod_php: a full restart is required to load the new module sudo apachectl configtest && sudo systemctl restart apache2 # PHP-FPM: restart the new pool, stop and disable the old one, reload the web server sudo systemctl restart php8.5-fpm sudo systemctl disable --now php8.3-fpm # swap in your old version sudo nginx -t && sudo systemctl reload nginx # or: sudo systemctl reload apache2 # List anything else still running old code (needrestart ships with Ubuntu) sudo needrestart -r l
A full reboot is only needed if the system says so, usually because the same upgrade brought in a new kernel or libc:
[ -f /var/run/reboot-required ] && cat /var/run/reboot-required.pkgs || echo "No reboot needed" sudo systemctl reboot
Warning: restart apache2 drops requests in flight, and every site on the server is unavailable for a few seconds. Always run apachectl configtest first, because a config error stops Apache from coming back. Don't use reload or graceful after a mod_php upgrade, because they can leave old workers serving requests.
Warning: before rebooting a remote server, make sure you have console access (your provider's web console) in case SSH doesn't come back. Take a snapshot first, and check that the database and other services are enabled to start at boot: systemctl is-enabled apache2 php8.5-fpm mariadb.
Uses packages.sury.org. After adding the repository, install the packages and switch the module exactly as in the Ubuntu section.
sudo apt update && sudo apt install -y lsb-release ca-certificates curl curl -sSLo /tmp/debsuryorg-archive-keyring.deb https://packages.sury.org/debsuryorg-archive-keyring.deb sudo dpkg -i /tmp/debsuryorg-archive-keyring.deb echo "deb [signed-by=/usr/share/keyrings/debsuryorg-archive-keyring.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" \ | sudo tee /etc/apt/sources.list.d/php.list sudo apt update sudo apt install -y php8.5 php8.5-cli php8.5-fpm
# Apache with mod_php sudo apachectl configtest && sudo systemctl restart apache2 # PHP-FPM sudo systemctl restart php8.5-fpm sudo systemctl disable --now php8.2-fpm # swap in your old version sudo nginx -t && sudo systemctl reload nginx # Find services still running old code (install it with: sudo apt install needrestart) sudo needrestart -r l # Reboot only if a kernel or libc update asks for it [ -f /var/run/reboot-required ] && cat /var/run/reboot-required.pkgs || echo "No reboot needed" sudo systemctl reboot
Warning: if you use Debian's own packages (apt install --only-upgrade php8.2 on bookworm, or php8.4 on trixie) instead of sury.org, the fixed versions are 8.2.35-1~deb12u1 (DLA-4848-1) and 8.4.27-1~deb13u1 (DSA-6574-1). [source] You still need to restart Apache or PHP-FPM afterwards. Installing the package doesn't replace running workers.
Warning: restarting Apache or PHP-FPM drops requests in flight. On a remote server, make sure you have console access before you reboot.
Uses the Remi repository and needs EPEL. Swap 9 for 8 or 10 to match your release.
Remi had no fixed build on release day, but 8.5.12, 8.4.27 and 8.3.36 were in the repository by 22 October. [source] Run dnf info php after updating and confirm it shows a fixed version before you rely on it.
sudo dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm sudo dnf install -y https://rpms.remirepo.net/enterprise/remi-release-9.rpm sudo dnf module reset -y php sudo dnf module enable -y php:remi-8.5 sudo dnf update -y 'php*'
RHEL-family systems run PHP through PHP-FPM by default. Restart it, then the web server:
sudo systemctl restart php-fpm sudo apachectl configtest && sudo systemctl restart httpd # or, for nginx: sudo nginx -t && sudo systemctl reload nginx # Which services still run old code? (needs dnf-utils / yum-utils) sudo needs-restarting -s # Does the whole system need a reboot? Exit code 1 means yes sudo needs-restarting -r; echo "exit=$?" sudo systemctl reboot
Warning: Red Hat's own php packages keep their old version numbers when they backport fixes, so php -v can't tell you whether you're patched. Check the errata with dnf updateinfo list --cve CVE-2026-109618. Red Hat says RHEL 8, 9 and 10 are affected (RHEL 7 is not), rates the issue Important, and as of 21 October had some updates out with more in progress. [source]
Warning: dnf module reset php changes which PHP stream the server follows. Test your applications on 8.5 before doing this in production. Restarting httpd drops requests in flight, and on a remote server you need console access before rebooting.
SLES 15 SP7 has a fixed php8 package (8.3.36). Install just the PHP2Shell patches, or everything pending:
sudo zypper refresh sudo zypper list-patches --cve=CVE-2026-109618,CVE-2026-109619 sudo zypper patch --cve=CVE-2026-109618,CVE-2026-109619 # or update the PHP packages directly sudo zypper update 'php8*' 'apache2-mod_php8' php -v
# PHP-FPM and/or Apache with mod_php8 sudo systemctl restart php-fpm sudo apachectl configtest && sudo systemctl restart apache2 # Processes still using deleted (old) files, grouped by service sudo zypper ps -s # Does the system need a reboot? Exit code 102 means yes sudo zypper needs-rebooting; echo "exit=$?" sudo systemctl reboot
Warning: as of 22 October, SUSE had also released backported fixes for the SLES 15 SP4–SP6 LTSS channels (php8 and php7, keeping their older version numbers). SLES 16.0 and 16.1 were still in progress, and openSUSE Leap 16 was still listed as affected. [source] If zypper list-patches shows nothing for you, use the stopgaps below until a patch lands.
Warning: restarting Apache drops requests in flight. On a remote server, make sure you have console access before rebooting.
Fedora ships recent PHP branches in its own repositories. Pull the updates once they reach updates; updates-testing often has them earlier.
sudo dnf upgrade --refresh 'php*' # not there yet? try the testing repo sudo dnf upgrade --refresh --enablerepo=updates-testing 'php*' php -v
sudo systemctl restart php-fpm sudo apachectl configtest && sudo systemctl restart httpd # or: sudo nginx -t && sudo systemctl reload nginx # Reboot check (exit code 1 means a reboot is needed) sudo dnf needs-restarting -r; echo "exit=$?" sudo systemctl reboot
Warning: packages from updates-testing haven't finished Fedora's QA. Disable the repo again after the PHP update. Restarting httpd drops requests in flight.
Amazon published fixes on 22 October: ALAS2023-2026-3301 to -3304 for php8.2 to php8.5 on Amazon Linux 2023, and ALAS2PHP8.2-2026-015 for the PHP 8.2 Extras topic on Amazon Linux 2. [source]
AL2023 pins packages to a repository release, so move to the newest release to pick up the fix:
# Amazon Linux 2023 sudo dnf check-release-update sudo dnf upgrade --releasever=latest 'php*' php -v # Amazon Linux 2 with the php8.2 Extras topic sudo yum update 'php*' php -v
sudo systemctl restart php-fpm sudo apachectl configtest && sudo systemctl restart httpd sudo needs-restarting -r; echo "exit=$?" sudo systemctl reboot
Warning: Amazon lists "No Fix Planned" for php8.1 on AL2023 and for the core php package on Amazon Linux 2. [source] Move those servers to php8.2 or later, or see PHP 8.1 and older.
Warning: --releasever=latest upgrades every package you name to the newest release, not just PHP. On EC2, check that the instance is behind a load balancer or has a recent AMI snapshot before rebooting. Instances in an Auto Scaling group should be replaced by rolling the launch template, not patched in place.
Package names include the branch (php84, php83, …). Upgrade the branch you use and check the version it reports:
apk update apk policy php84 # shows available versions; swap in your branch apk upgrade 'php84*' php84 -v
rc-service php-fpm84 restart rc-service nginx reload # or: rc-service apache2 restart reboot # only after a kernel (linux-lts / linux-virt) upgrade
Warning: Alpine has php84 8.4.27-r0 in v3.22 and edge as of 22 October. [source] If apk policy doesn't show a fixed version for your branch and Alpine release, use the stopgaps below. Most Alpine PHP runs in containers. There, rebuild the image and recreate the container (see Docker) instead of patching a running container.
Arch tracks the latest PHP. Always upgrade the whole system:
sudo pacman -Syu php -v
sudo systemctl restart php-fpm sudo apachectl configtest && sudo systemctl restart httpd # or: sudo nginx -t && sudo systemctl reload nginx # Reboot if the kernel was upgraded (running kernel no longer installed) pacman -Q linux; uname -r sudo systemctl reboot
Warning: never run pacman -Sy php on its own. Partial upgrades are unsupported on Arch and can break the system. A full -Syu may also bring in a new kernel, which needs a reboot before kernel modules load correctly.
On CloudLinux, fixed ea-php52 to ea-php85 packages are released for CloudLinux 7 to 10, and alt-php 5.2 to 8.5 is fixed in the stable repositories of CloudLinux 7, 8, 9 and CloudLinux for Ubuntu 22.04. CloudLinux 10 gets alt-php from the ELS ALT PHP repository through a normal update. [source]
# CloudLinux 8, 9, 10 (use yum instead of dnf on CloudLinux 7) sudo dnf clean all sudo dnf upgrade 'ea-php*' 'alt-php*' # CloudLinux for Ubuntu sudo apt-get update && sudo apt-get upgrade # Which PHP versions are installed and assigned /usr/local/cpanel/bin/rebuild_phpconf --current
These packages carry the fix as a backport and keep a lower version number (for example, alt-php85 8.5.11-5 is fixed). Check the changelog for the CVE instead: [source]
rpm -q --changelog alt-php85-common | grep -E "CVE-2026-(109618|109619)" rpm -q --changelog ea-php85-php-common | grep -E "CVE-2026-(109618|109619)" # swap in your versions
/scripts/restartsrv_apache_php_fpm /scripts/restartsrv_httpd # LiteSpeed: restart lsws so lsphp workers reload # Reboot check (CloudLinux/AlmaLinux base) sudo needs-restarting -r; echo "exit=$?" sudo reboot
Warning: CloudLinux's security metadata (OVAL, updateinfo) wasn't published yet on 22 October, so yum --security or dnf upgrade --security won't list these packages. Use a normal update. If nothing installs, update the cloudlinux-release package first. [source]
Warning: on shared servers, each account can be set to a different PHP version. Update every installed ea-php and alt-php version, not just the default. Restarting httpd briefly interrupts every hosted site. Do it outside peak hours, and announce it if you have SLAs.
Plesk ships patched PHP 8.5.12, 8.4.27, 8.3.36 and 8.2.35 for Linux and Windows, plus patched builds of the end-of-life 8.1, 8.0 and 7.4 handlers. [source] Install them from Tools & Settings › Updates, or from the command line:
plesk installer --select-release-current --upgrade-installed-components # List every PHP handler and its version plesk bin php_handler --list
Plesk's own panel runs on a separate PHP (sw-engine). Plesk lists the panel fix in Plesk Obsidian 18.0.80 Update 11 and 18.0.81 Update 4. [source] Check with plesk version, and limit panel access to trusted IPs until you're on one of those.
Warning: updating a PHP handler restarts its PHP-FPM service. Update every installed handler, including ones no site uses today.
CustomBuild ships the new 8.2 to 8.5 releases and a patch for older branches (5.6 to 8.1) that keeps their version number. DirectAdmin says the one patch file covers both CVEs, and it only takes effect once PHP is recompiled. [source]
da update da build versions | grep -i php # see what's available da build php # recompile every installed PHP version # The CVE patch files CustomBuild applies to older branches ls /usr/local/directadmin/custombuild/patches/php-*/ | grep 109618
Warning: CustomBuild doesn't rebuild PHP on its own unless its cron is set to. On LiteSpeed servers, run da update again before building: a fix released on 22 October corrects the patch order for lsphp. [source]
Forge's automatic security updates don't patch PHP, because Forge installs PHP from Ondřej Surý's repository rather than Ubuntu's. [source] On each server, open the PHP tab, choose Update PHP X.X for every installed version, or over SSH:
sudo apt-get update
apt-cache policy php8.4-fpm # Candidate should be the fixed version
sudo apt-get install --only-upgrade -y \
-o Dpkg::Options::="--force-confold" \
$(dpkg -l 'php8.4*' | awk '/^ii/ {print $2}')
# Long-running workers keep the old PHP until restarted
php artisan queue:restart
php artisan horizon:terminate
php artisan octane:reloadRepeat for every PHP version installed on the server, including ones no site uses. Forge recommends the dashboard route because it also repairs the PHP package source. [source]
Pin the patched tag in your Dockerfile, then rebuild with --pull so you don't reuse a cached vulnerable layer.
# Dockerfile: pick the variant you use FROM php:8.5.12-apache # FROM php:8.5.12-fpm # FROM php:8.5.12-cli
docker build --pull --no-cache -t myapp .
Containers have to be recreated from the new image. Restarting an existing container keeps the old, vulnerable PHP.
# Docker Compose docker compose up -d --force-recreate # Plain Docker docker stop myapp && docker rm myapp docker run -d --name myapp [your previous flags] myapp # Kubernetes: roll out the new image and wait for it to finish kubectl set image deployment/myapp app=registry.example.com/myapp:php-8.5.12 kubectl rollout status deployment/myapp # Confirm what is actually running docker exec myapp php -v
Warning: docker restart and docker compose restart do NOT pick up a new image. Recreating a container drops anything written inside it that isn't on a volume, so check your volumes first. Rebuild every image that uses FROM php:…, including base images other teams maintain.
Warning: the host only needs a reboot if its own kernel was updated. The PHP fix lives entirely inside the image.
brew update brew upgrade php php -v
# PHP-FPM managed by Homebrew brew services restart php # Homebrew Apache or nginx, if they serve PHP brew services restart httpd brew services restart nginx # Local dev servers (php -S, Laravel Valet/Herd, etc.): stop and start them again valet restart
Warning: a versioned formula such as php@8.3 doesn't move to 8.5 on its own. Run brew upgrade php@8.3 to get 8.3.36, or switch with brew unlink php@8.3 && brew link php. No reboot is needed.
Download the 8.5.12 zip from windows.php.net/download. Choose Thread Safe for Apache's mod_php and Non Thread Safe for IIS or FastCGI. Stop the web server before extracting, otherwise running php-cgi.exe processes keep the old DLLs locked. Then extract over your existing PHP folder, keeping your php.ini.
# IIS iisreset /stop # ...extract PHP 8.5.12 over C:\PHP, keep php.ini... iisreset /start # Or recycle a single site's app pool instead of all of IIS Import-Module WebAdministration Restart-WebAppPool -Name "MySitePool" # Apache service Stop-Service Apache2.4 # ...extract PHP 8.5.12... Start-Service Apache2.4 # Make sure no old PHP is still running Get-Process php-cgi, php -ErrorAction SilentlyContinue # Reboot only if Windows itself asks for it Restart-Computer -Confirm
Warning: iisreset takes every site on the server offline until IIS starts again. Recycling a single app pool doesn't. If files are still locked after IIS stops, check for leftover php-cgi.exe processes before replacing anything.
Warning: before restarting a remote Windows server, make sure you can reach it over RDP or an out-of-band console, and that IIS and Apache are set to start automatically.
Synology has fixed packages. Update to at least: PHP 8.4 8.4.27-0051, PHP 8.3 8.3.36-0051, PHP 8.2 8.2.35-0171, PHP 8.1 8.1.34-0120, PHP 8.0 8.0.30-0122, PHP 7.4 7.4.33-0131, Mail Station 30000002.3.19-20333 and Synology Calendar 3.0.4-21435. PHP 7.3 won't be fixed. Synology rates the PHP built into DSM itself as very low risk because it isn't exposed externally. [source]
If Package Center doesn't offer the update yet, download the package from Synology's Download Center and install it with Package Center › Manual Install.
QNAP had no fixes on 22 October for QTS, QuTS hero, QuTScloud and several QNAP apps. Until it does, keep the NAS off the internet: turn off port forwarding and UPnP on your router, use a VPN for remote access, and limit management ports to trusted networks. [source]
Rebuild with the same ./configure flags you used before. php -i | grep "Configure Command" prints them.
curl -LO https://www.php.net/distributions/php-8.5.12.tar.xz tar xf php-8.5.12.tar.xz && cd php-8.5.12 ./configure --prefix=/usr/local/php85 [your previous flags] make -j"$(nproc)" && sudo make install
# Restart the services that load your custom build (names vary by setup) sudo systemctl restart php-fpm sudo apachectl configtest && sudo systemctl restart apache2 # Confirm the running FPM master was started from the new binary ps -o pid,lstart,cmd -C php-fpm | head -3 /usr/local/php85/sbin/php-fpm -v
Warning: make install overwrites the binary, but processes that were already running keep the old code in memory until they're restarted. If you installed under a new prefix, update your service unit, Apache LoadModule line or PATH to point at it. Otherwise you'll restart into the old version.
Check the version the web server runs, not just the command line. They are often different binaries.
php -v php-fpm8.5 -v 2>/dev/null # what the web server actually runs (delete the file afterwards): echo '<?php echo PHP_VERSION;' | sudo tee /var/www/html/v.php curl -s http://localhost/v.php; echo; sudo rm /var/www/html/v.php
Ubuntu, Debian, Red Hat, SUSE, CloudLinux, DirectAdmin and other vendors often backport the fix without changing the version number, so an "old" version can be fixed and scanners may still flag it. For those, check the vendor's changelog or advisory for the CVE IDs. [source] [source]
Then stop advertising your version. Set this in the php.ini your web server loads, and restart:
expose_php = Off
Restarting PHP-FPM or Apache isn't always enough. PHP processes started from the command line keep running the old, vulnerable PHP until they're restarted: queue workers, Laravel Horizon, Octane and Reverb, Symfony Messenger consumers, and anything Supervisor or systemd keeps alive. [source]
# Laravel
php artisan queue:restart
php artisan horizon:terminate
php artisan octane:reload
# Symfony Messenger
php bin/console messenger:stop-workers
# Supervisor-managed workers
sudo supervisorctl restart all
# Anything still running an old PHP binary (deleted file still mapped)
sudo lsof -nP 2>/dev/null | grep php | grep '(deleted)' | awk '{print $1, $2}' | sort -uzend_mm_heap corrupted in code that uses SimpleXML. It's a crash, not a security hole. The fix was merged on 22 October but isn't in a release yet. [source] Don't roll back to a vulnerable version. Users report that zend.enable_gc=0 avoids the crash until the next release; test it first, because it can raise memory use. [source]unserialize() bug is still open. A use-after-free reported in unserialize() reproduces on the patched releases and has no fix yet. [source] It isn't part of PHP2Shell, and it matters only to applications that pass untrusted input to unserialize(), which PHP's manual already warns against. [source]session.upload_progress.enabled=0 even after patching if your application doesn't need the feature. [source]These branches are end-of-life, and PHP ships no fixed release for them. The best fix is to move to 8.2 or later (ideally 8.5.12) using the steps above. If you can't yet, these vendors ship backported fixes that keep the old version number:
php7 and older php8 on SLES 15 SP4 to SP6. [source]alt-php 5.2 to 8.1 and ea-php52 to ea-php81 (see cPanel / CloudLinux). [source]/opt/alt/. [source]PHP-x.y-CVE-2026-109618-109619 branches in php-src. [source]Anything older without a vendor fix stays vulnerable. Take it offline, or isolate it and apply the stopgaps below.
php.net's temporary mitigations reduce exposure but are not a fix. [source] Put them in php.ini or your FPM pool, not in .user.ini or ini_set(), then restart every worker:
memory_limit = -1 ; enforce with php_admin_value so apps can't override it post_max_size = 8M ; 32M if you need uploads; keep upload_max_filesize below it session.upload_progress.enabled = 0 fatal_error_backtraces = 0 ; PHP 8.5 only
Remove memory_limit = -1 once you're patched. It lets a single request use all of the server's memory.
Web application firewall rules help while you patch, but none of them closes the vulnerability.
AWSManagedRulesPHPRuleSet version 2.3 or later (its PHP2Shell_BODY rule targets CVE-2026-109619) and the SizeRestrictions_BODY rule in the core rule set for CVE-2026-109618. Make sure neither is overridden to Count. [source]