Multi-tenant cPanel hosts live or die on inter-account isolation. The default Apache mod_php runs as the Apache user across all accounts — meaning a webshell in one account can read every other account’s files. PHP-FPM with suEXEC fixes that, but only if it’s configured per-account and not bypassed. CageFS on CloudLinux is the stronger version of the same idea.
What’s happening
cPanel supports two PHP handlers worth using on a multi-tenant host: suPHP (CGI-based, runs PHP as the account user, slow) and PHP-FPM (FastCGI, dedicated pool per account, fast). Both isolate PHP execution to the account’s UID, so a compromised account cannot read /home/<other-user>/ directly. mod_php and the older DSO handler do not isolate — they are inappropriate for shared hosting.
How to verify
whmapi1 php_get_handlers
whmapi1 php_get_users_with_handler handler=fpm
ls -la /opt/cpanel/ea-php74/root/usr/share/cagefs-skeleton 2>/dev/null
ps auxf | grep -E "php-fpm|httpd" | head -20
cat /var/cpanel/userdata/<user>/<domain>.php-fpm.yaml 2>/dev/null
ps auxf shows whether php-fpm pools are running as the cPanel users or as a single shared user.
The fix
- WHM > MultiPHP Manager: set every account’s PHP handler to
PHP-FPM. The default in cPanel-recent installs issuphp, which works but is slow. PHP-FPM is the recommended path. - Per-account FPM pool:
whmapi1 php_set_user_handler user=<user> handler=fpm. Each account gets its own pool running as the account UID. - Confirm
open_basedirfor each pool. cPanel setsopen_basedir = /home/<user>/:/tmp/by default; verify in/var/cpanel/userdata/<user>/<domain>.php-fpm.yaml. This prevents PHP from reading other accounts even if the UID checks were bypassed. - CageFS on CloudLinux: provides chroot-like isolation per account, hiding
/etc/passwd,/proc, and other accounts’ home directories. If CloudLinux is licensed, enable CageFS for every account in WHM > CloudLinux > CageFS Management. disable_functions: in each FPM pool, disableexec,system,passthru,shell_exec,proc_open,popen,pcntl_exec. These are the functions a webshell needs. The downside: some legitimate WordPress plugins useproc_open— exception per-account if needed.upload_tmp_dirandsession.save_pathinside each account’s home, not shared/tmp. cPanel sets this automatically with FPM pools.- Audit periodically: a
for u in $(whmapi1 listaccts); do whmapi1 php_get_user_handler user=$u; donemakes sure no account has been silently switched todsoormod_php.
Stack Harbor enforces PHP-FPM with per-account isolation under cPanel server administration.