OFFICIAL REMEDIATION GUIDE
How to Patch PHP2Shell on cPanel, WHM & CloudLinux alt-php
cPanel and WHM run multiple PHP versions side-by-side via EasyApache 4 and CloudLinux alt-php. Learn how to verify every version and upgrade packages via dnf/yum.
cPanel servers typically install multiple PHP versions side-by-side under /opt/cpanel/ea-php* and /opt/alt/php*. You must check and upgrade every version assigned to your hosting accounts.
Step 1: Check All Installed EasyApache PHP Versions
Inspect all binaries installed under the EasyApache 4 tree:
for p in /opt/cpanel/ea-php*/root/usr/bin/php; do $p -v | head -1; done
Step 2: Update All EasyApache Packages via Package Manager
Run dnf (or yum on older AlmaLinux/CentOS) to apply cPanel vendor updates:
sudo dnf upgrade "ea-php*" "alt-php*" -y
# Or on CentOS 7:
sudo yum update "ea-php*" "alt-php*" -y
Step 3: Restart PHP-FPM Services in WHM
Restart all FPM pools from the command line:
/scripts/restartsrv_apache_php_fpm
systemctl restart httpd