πŸ› οΈ PHP Selector Module Management Guide

Target Stack: CloudLinux 9.5 + cPanel 126

CloudLinux’s PHP Selector allows fine-grained control of PHP modules per user or server-wide via selectorctl. This is essential for shared hosting environments where different applications require different PHP setups.


πŸ“Œ Prerequisites

Before managing PHP modules:

  • βœ… Root access to the server
  • βœ… CloudLinux PHP Selector installed
  • βœ… CageFS enabled and configured for users
  • βœ… Relevant PHP versions and modules installed via alt-php

πŸ“‚ Module Management Per User

To enable specific PHP extensions for a single cPanel user, use:

selectorctl --enable-user-extensions=mysql,mysqli --version=5.6 --user=exampleuser
selectorctl --enable-user-extensions=json --version=5.6 --user=exampleuser

πŸ” Explanation:

  • --enable-user-extensions=: Comma-separated list of extensions
  • --version=: Target alt-PHP version (e.g., 5.6, 7.4, 8.1)
  • --user=: cPanel username (replace exampleuser accordingly)

🌐 Enable Modules Globally (All Users)

To apply PHP modules globally for all users using PHP 5.6:

selectorctl --enable-extensions=apcu,bcmath,dom,fileinfo,gd,imagick,imap,ioncube_loader,json,mbstring,mcrypt,memcache,mysql,mysqli,mysqlnd,opcache,pdf,pdo,pdo_mysql,phar,posix,pspell,redis,soap,sockets,suhosin,tidy,xmlreader,xmlwriter,xsl,zend_guard_loader,zip --version=5.6

To verify the available PHP extensions for a version:

selectorctl --list-extensions --version=5.6

πŸ”„ Reset All User Modules to Match Global Settings

To reset all users’ PHP modules to match the global defaults:

cagefsctl --cl-selector-reset-modules

This is useful after major global configuration changes.


βœ… Final Steps

Always run the following after modifying PHP Selector settings:

cagefsctl --force-update

Optionally restart your web service (depending on your setup):

systemctl restart httpd     # For Apache
systemctl restart lsws      # For LiteSpeed

πŸ§ͺ Test Module Availability

Create a simple PHP info file in the user’s public_html directory to verify the loaded modules:

<?php phpinfo(); ?>

Visit https://domain.com/phpinfo.php and check the Loaded Extensions section.

Scroll to Top