How to Install All Alt-PHP Packages on CloudLinux
CloudLinux 8 allows hosting multiple PHP versions using Alt-PHP, giving administrators flexibility and control over PHP configurations. A common issue is that after installing an Alt-PHP version, only core modules appear in PHP Selector. Essential extensions like mbstring, gd, mysqlnd, and xml may be missing.
The fastest and most reliable way to install all PHP extensions for your Alt-PHP versions is:
yum -y groupinstall alt-php
⚠️ Important: This command must be run as root or using
sudoto install system-wide packages.
Why Use yum -y groupinstall alt-php?
Installing a specific Alt-PHP version individually (for example, PHP 8.1):
yum install alt-php81-cli alt-php81-devel alt-php81-php-fpm
only installs the core packages, not the full set of extensions.
yum -y groupinstall alt-php installs:
- All core Alt-PHP packages (
cli,fpm,common,devel) - Common PHP extensions:
mbstring,gd,xml,mysqlnd,pdo_mysql,intl,soap,opcache, and more - Ensures PHP Selector displays the full module list
Step-by-Step Guide
Step 1: Log in as Root
You must have root access to install Alt-PHP packages:
sudo -i
or log in directly as the root user.
Step 2: Verify CloudLinux Repositories
Check that CloudLinux repositories are active:
yum repolist | grep -i cloudlinux
You should see entries like:
cloudlinux-8cl-ea4
If your server isn’t registered:
clnreg_ks --force
Step 3: Install All Alt-PHP Packages
Run the group install command:
yum -y groupinstall alt-php
This will install all core packages and extensions for all installed PHP versions.
Step 4: Refresh PHP Selector
After installation, update PHP Selector to recognize the new modules:
selectorctl --update
Step 5: Update CageFS (If Enabled)
If CageFS is enabled on your server:
cagefsctl --force-update
cagefsctl --remount-all
This ensures all users see the new PHP modules.
Step 6: Verify Installed Extensions
Check installed extensions for a specific PHP version:
/opt/alt/php81/usr/bin/php -m
You should now see:
mbstringgdmysqlndpdo_mysqlxmlintlsoapopcache
Benefits
- Installs all Alt-PHP packages and extensions in one command
- Saves time compared to installing individual packages manually
- Ensures PHP Selector shows all available modules
- Compatible with multiple PHP versions
- Works seamlessly with CageFS in shared hosting environments
Best Practices
- Always update repositories before installation:
yum clean all
yum makecache
- Run
selectorctl --updateandcagefsctl --force-updateafter installation - Verify modules with
/opt/alt/phpXX/usr/bin/php -m - Repeat
groupinstallwhen adding new PHP versions
Conclusion
yum -y groupinstall alt-php is the fastest and most reliable way to install all Alt-PHP packages and extensions on CloudLinux 8. Running the command with root privileges ensures full installation and proper PHP Selector integration, giving your server a complete, ready-to-use PHP environment.
Check out our cheap and reliable web hosting





