PHP Selector is the per-user PHP-version chooser that ships with CloudLinux. On a shared
cPanel server it removes the single biggest support category: "my site needs PHP 7.4 but
your server runs 8.2". Each user picks their own version — 5.6 through 8.4 — plus
extensions and php.ini directives, all without root access and without affecting other
users.
The catch is that it depends on CageFS being enabled and alt-php being installed. Skip either step and the selector either silently does nothing or breaks every site on the server. This guide does it in the right order: alt-php packages first, CageFS enabled, selector turned on, defaults configured.
Prerequisites
You need:
- CloudLinux installed and an active licence. If you haven't installed it yet, see installing CloudLinux on cPanel.
- Root SSH access to the cPanel server.
- At least 8 GB of free space in
/opt/alt/— the full alt-php package set across 11 versions takes 6-7 GB on disk. - LiteSpeed or Apache with
mod_lsapias the PHP handler. PHP-FPM works too but loses some per-user override capability. If you're on stock CGI or DSO handlers, switch first or the selector won't apply per-user.
Step 1 — Install the alt-php package set
CloudLinux ships PHP as alt-php packages, separate from EasyApache's PHP. Install all
supported versions in one go:
yum groupinstall alt-php
On a fresh CloudLinux install this pulls roughly 2,300 packages and takes 8-12 minutes.
Each version gets its own /opt/alt/phpXX/ tree with the full extension set
pre-compiled.
To install only specific versions (e.g. you don't need PHP 5.6 because no customer asked for it):
yum install alt-php74 alt-php80 alt-php81 alt-php82 alt-php83 alt-php84
Confirm the versions installed:
selectorctl --available
You should see one line per installed version, e.g. 5.6 7.4 8.0 8.1 8.2 8.3 8.4.
Step 2 — Enable CageFS
CageFS is the per-user filesystem isolation layer. Without it, PHP Selector has nothing to isolate against and silently no-ops:
cagefsctl --init
cagefsctl --enable-all
--init builds the cage skeleton (creates /usr/share/cagefs-skeleton/, populates
binaries, sets up the virtual /proc views). It takes 2-5 minutes on first run.
--enable-all enables CageFS for every existing cPanel user. New cPanel accounts will
also be auto-caged from this point forward (this is the cPanel-aware behaviour;
CloudLinux's hook into cPanel handles new account creation).
Verify a user is caged:
cagefsctl --user-status exampleuser
Expected output: Enabled. If you see Disabled, run cagefsctl --enable exampleuser
manually.
Step 3 — Enable PHP Selector
PHP Selector itself is a flag in CageFS:
selectorctl --enable-selector
This installs the user-facing selectorctl binary inside the cage, registers the
"Select PHP Version" icon in cPanel under the Software section, and pulls the
default version map from /etc/cl-selector/.
Restart the cPanel UI service so the icon shows up immediately:
service cpsrvd restart
Step 4 — Set sensible global defaults
Two configuration files govern selector defaults — both live in /etc/cl-selector/:
defaults.cfg— sets the default PHP version for users who haven't picked onenative.cfg— sets the "native" version that EasyApache PHP would be (selector inherits this if a user explicitly chooses "native")
Edit defaults.cfg:
nano /etc/cl-selector/defaults.cfg
A working set of defaults for a 2026 server:
default=8.2
modules=apcu,curl,gd,imagick,intl,mbstring,mysqli,opcache,pdo_mysql,redis,soap,xml,zip
Bumping the default extension set saves users a click — most WordPress and Laravel installs need exactly these. Save and run:
selectorctl --apply-defaults
This rewrites every user's PHP profile to match the new default. Users who had manually selected a version keep their choice; users who never touched the selector get the new default.
Step 5 — Configure per-user limits
The selector lets users pick their PHP version and toggle extensions, but you may want to restrict what versions are available per-user (e.g. only allow modern PHP for new customers).
To restrict a single user to PHP 8.1+:
selectorctl --set-versions=8.1,8.2,8.3,8.4 --user=exampleuser
To set the global allow-list (applies to users without per-user overrides):
selectorctl --set-allowed-versions=7.4,8.0,8.1,8.2,8.3,8.4
Anything not in the allowed list disappears from the dropdown. Sites running on a disallowed version keep running — the selector only gates the picker, not currently- running PHP. You'll need to migrate them off manually before retiring a version.
Step 6 — Test as a user
Switch to a non-root cPanel user and confirm:
su - exampleuser
selectorctl --user-current
Expected output: the user's current PHP version and the extension set. If you get
Permission denied or a missing binary, CageFS isn't set up correctly for this user —
re-run cagefsctl --enable exampleuser and recheck.
Then load the cPanel interface as that user and confirm the Select PHP Version
icon appears under Software. Click through, change version, save, and reload a
page on one of the user's domains. The X-Powered-By header should reflect the new
version.
Three configuration mistakes that flood support
-
Forgetting
selectorctl --apply-defaultsafter editing defaults.cfg. The file changes but no user actually picks up the new default. Every new account gets the old default until you apply it. -
Not coordinating PHP Selector versions with EasyApache versions. If EasyApache only has PHP 8.2 enabled but the selector allows PHP 8.4, sites selecting 8.4 actually run on alt-php's 8.4 (which is correct — alt-php is independent of EasyApache). But monitoring tools that read EasyApache config will report PHP 8.2 across the fleet. Document this in your runbook.
-
Enabling
mod_lsapionly for some users. PHP Selector requires every user's handler to belsphp(under LiteSpeed) ormod_lsapi(under Apache). Mixed handlers break the per-user override silently. Set the handler globally in EasyApache and don't override per-domain.
Does PHP Selector work without CageFS?+
Can users change php.ini values themselves?+
What happens to existing sites when I enable PHP Selector?+
Does PHP Selector affect server PHP performance?+
Can I use PHP Selector with PHP-FPM?+
How do I disable PHP Selector for a single user?+
Next steps
- Tune LVE limits now that users can pick heavier PHP versions — see CloudLinux LVE tuning without angry customers.
- If you also run MySQL Governor for per-user database throttling, walk through MySQL Governor modes explained.
- Activate or renew a CloudLinux licence if you haven't yet.