When you open cPanel → Select PHP Version and get the dreaded:
Cannot manage PHP versions when CageFS is disabled
…it usually isn’t PHP’s fault at all. On CloudLinux servers, this error almost always boils down to two things:
-
pam_lveis enabled forsudo(it shouldn’t be), and/or -
The cPanel user is disabled in CageFS.
Here’s the exact, production-safe fix we use at PrenHost.
TL;DR (copy–paste)
Open cPanel → Select PHP Version again. It should load instantly.
What’s actually happening?
-
PHP Selector (alt-PHP) only works inside CageFS. If a user is not caged, the page refuses to manage PHP versions for that account.
-
Adding
pam_lve.soto/etc/pam.d/sudounintentionally puts the helper that manages PHP Selector inside a cage, blocking access to system paths (like/usr/share/cagefs). That’s why the UI errors—even when CageFS is globally “Enabled”.
Keep pam_lve in sshd, su, crond, atd (recommended), but remove it from sudo.
Step-by-step with quick checks
1) Confirm the symptoms
If you see users listed as disabled, or pam_lve present in /etc/pam.d/sudo, proceed.
2) Remove pam_lve from sudo only
You should still see pam_lve in sshd, su, crond, atd—not in sudo.
3) Refresh CageFS & alt-PHP bits
4) Enable CageFS for the accounts that need PHP Selector
All at once:
—or per user:
Verify:
5) Make sure alt-PHP is installed
6) Restart cPanel UI and test
Then, as one of the affected users:
Open cPanel → Select PHP Version. The error should be gone.
When should I not enable CageFS?
Some legacy apps or special service accounts might be intentionally outside CageFS. Those users cannot use PHP Selector; manage them via WHM → MultiPHP Manager (EA-PHP) instead.
Troubleshooting checklist
-
Error persists only for certain users
→ They are still disabled in CageFS. Enable them and re-run--force-update. -
Selector page loads, but PHP doesn’t change
→ Rebuild alt-PHP INIs:cagefsctl --rebuild-alt-php-ini.
→ Ensure no custom.htaccessorphp.inioverrides are forcing EA-PHP. -
Server recently migrated
→ Reinstall the alt-PHP group and refresh cages:dnf/yum groupinstall -y alt-php && cagefsctl --force-update.
Final thoughts
This fix is simple but easy to miss: don’t apply pam_lve to sudo. Pair that with enabling CageFS for the right users, and PHP Selector will behave perfectly.
If you’d like PrenHost to audit your CloudLinux estate (CageFS, LVE, alt-PHP, IO/CPU limits), reach out—this is the kind of hands-on tuning we perform daily for high-density cPanel servers.