Managing PHP versions and extensions is an essential task for website owners who want to ensure their websites are secure, stable, and optimized for performance. With the MultiPHP Manager tool & PHP Selector in CPanel, you can easily select the PHP version and extensions you want to use for each website/domain.
In this article, we'll explore how to use these tools and cover what you need to know, to manage the PHP parameters for your application.
Notice that in our shared hosting service, after purchasing you will be deployed in the latest PHP version at the time of purchase. So for most applications this should work out of the box without extra steps, at each PHP version issued, we will be automatically upgrading your version too if "inherit" is set, we will cover this in more details below.
0) The basics:
To provide users with a range of options for managing their PHP environments, we offer two distinct PHP packages for each version of PHP: ALT (Provided and managed at **PHP Selector**) provided by CloudLinux and EA (Provided and managed at **MultiPHP Manager**), provided by CPanel.
These packages include compiled versions of PHP, rather than the original PHP source code to include additional optimizations and features such as security patches that are not available for the standard original source code.
Within CPanel you will see as example: ea-php82, this is showing you are using the package provided by CPanel at version 8.2
So, what is the difference between these packages, which one is best? Both of these packages are updated regularly and are very stable, both contain security patches and optimization features, the main difference usually for clients is the interface in which they will be interacting with when adjusting PHP settings and extensions. You can find more information in the section "PHP settings and extensions".
Additionally the EA-PHPxx package, includes the "inherit" feature, more on that on section 3.
1) Changing the PHP version:
So now you noticed that you either have a outdated version or need a older version for running a certain application or CMS. I will be using the former as a example, while updating to version 8.2 from the ea package, latest at time of writing.
Example1:
a) After login into the CPanel interface, look for "MultiPHP Manager" on the search bar or by scrolling the menu until the "Software" Section:
b) Notice the current PHP version:
c) To update, simply: select the domain, select the version and click apply and done!
Example 2: How does it differ when setting ALT-php82
Since the package alt-phpXX is provided by a additional source within the CPanel environment, we need to ensure that they are aligned between themselves, this is a very simple process.
a) Change the php version to alt-php82 like the example 1, then go to Select PHP version
b) At PHP Selector, simply select the version you need and then apply, click on "Use PHP Selector"
c) Now you are using the version from the package alt-php82.
3) PHP settings and extensions
Changing settings for PHP when using either of these packages is quite straight forward.
On the EA-PHPxx you will need to look for the "MultiPHP INI Editor" and there use either the Basic Mode to be guided by the GUI or insert manually the directives through the "Editor Mode"
While using the ALT-PHPxx package, you have access to a more convenient and friendly interface specifically for extensions, this is perfect for when you need a extension and is not familiar how to add through php.ini directives
Simply go to extensions page, and start adding or removing the extensions you need.
Additionally, at the Options tab, you can edit the configurations for php such as:allow_url_fopen, display_errors, error_reporting, file_uploads, include_path, log_errors, etc.
3) Keeping your PHP versions up-to-date, definition of inherit
It is very important to keep the PHP version up-to-date of your platform, updating the application you are using and its add-ons to be compatible, this will keep you safe from vulnerabilities of the PHP language for example.
Whenever a php version is issued by CPanel or CloudLinux, these versions will be available in your environment through the interfaces mentioned above configured with standard extensions and options.
The first and easiest way to manage this is to use the " inherit " function, placed at the MultiPHP Manager. This function does not explicitly sets the php version but sets it to follow whatever is the latest version available in the system, this means you are always up-to-date
Notice that this is only available for CPanel packages (EA-PHPxx)
The second and a little more tricky way is to simply update manually. Each year a version is released and you can choose to change it, notice that if you are using a version that is not "inherit" manual upgrade will be required.
More information:
- Question: How vulnerable are the older versions of PHP?
- Reply: Since we are not using standard PHP from the community source, the versions provided by CPanel, but specially Cloudlinux are hardened and constantly patched to cover vulnerabilities, but we cannot emphasize enough the importance of having the latest version and unfortunately we cannot guarantee that all End-of-Life versions will be kept.