How to Manage PHP Versions with CloudLinux PHP Selector on cPanel
Tested Environment: CloudLinux 9.5 + cPanel
🔄 Switch Users from Native PHP to a Specific Version
To migrate all users currently using native PHP to a specific version (e.g., PHP 7.4), run:
selectorctl --change-to-version=7.4 --version=native
💡 Replace
7.4
with the target PHP version (e.g.,5.6
,8.1
, etc.).
🌐 Set a Default PHP Version for New Accounts
To make PHP 5.6 the default version for all newly created cPanel accounts:
selectorctl --set-current=5.6
📌 This only applies to new users added after the command is run. It will not affect existing users.
✅ View Available PHP Versions
To list all PHP versions installed on the server:
selectorctl --list-available
To list only enabled versions:
selectorctl --list-enabled
⚙️ Enable or Disable Specific PHP Versions
Enable PHP 5.6 in the selector:
selectorctl --enable=5.6
Disable PHP 7.3 from the selector:
selectorctl --disable=7.3
🔁 Sync PHP Configuration for All Users
After making version changes, apply the updates to all existing users:
selectorctl --sync-users
Example Use Case:
If you’ve just enabled PHP 8.2 and want all native users moved to it and future users to default to 8.2:
selectorctl --enable=8.2
selectorctl --change-to-version=8.2 --version=native
selectorctl --set-current=8.2
selectorctl --sync-users