Navratri Festive Offer: 50% Off Cloud Hosting + FREE Migration Get It Now!
It's often necessary to install many PHP versions and extensions on a cPanel/WHM server. This need arises, especially if different applications need different PHP versions. Here's a simple guide:
Log in to WHM
Open your WHM (Web Host Manager) interface by accessing https://your-server-ip :2087.
Log in with your root credentials.
Install EasyApache
EasyApache 4 is the tool used to manage PHP versions and extensions.
In WHM, search for "EasyApache 4" in the search bar.
Click on "EasyApache 4" to open the interface.
Customize Profile
Click on "Customize" next to the currently installed profile.
Go to the "PHP Versions" section.
You will see a list of available PHP versions. Select the versions you want to install (e.g., PHP 7.4, PHP 8.0, PHP 8.1).
After selecting, click on "Next" to proceed.
Install PHP Extensions
After selecting PHP versions, you can choose extensions for each PHP version.
Go to the "PHP Extensions" section.
Select the extensions you need for each PHP version. Popular extensions include mysqli, gd, mbstring, curl, zip, etc.
Click "Next" to proceed.
Review and Provision
Review the settings you've selected.
Click on "Provision" to start the installation process. This may take a few minutes.
Set Default PHP Version for Accounts
Once installed, you can set the default PHP version for your server or individual accounts.
Go back to WHM and search for "MultiPHP Manager.
In MultiPHP Manager, you can set the default PHP version for the entire server or manage it on a per-account basis.
Manage PHP Extensions
You can manage PHP extensions for specific versions in WHM under "PHP-FPM" or "MultiPHP INI Editor
This allows you to enable or disable extensions per account or globally for each PHP version.
Verify Installation
You can verify that multiple PHP versions are installed and available by creating a phpinfo() file in different directories or subdomains configured with different PHP versions.
Updating PHP Versions and Extensions: To update PHP versions or extensions, repeat the process in EasyApache 4.
PHP Selector: If you have CloudLinux installed, you can use PHP Selector to manage multiple PHP versions more efficiently.
This setup should allow you to support multiple PHP versions and extensions across different websites hosted on your cPanel/WHM server.
Let’s talk about the future, and make it happen!