Changing the PHP version in cPanel is a common task for website administrators, as different applications and websites may require specific PHP versions to function correctly. Fortunately, cPanel provides two robust tools to manage PHP versions: CloudLinux PHP Selector (the "Select PHP Version" page) and cPanel's MultiPHP Manager. This article will guide you through the process of changing your PHP version using both tools and explain the differences between them.

Using the CloudLinux PHP Selector

The CloudLinux PHP Selector is an excellent tool allowing you to manage and customize PHP versions for your hosting account easily. Here’s how to use it:

Step-by-Step Guide:

  1. Login to cPanel:

  2. Navigate to PHP Selector:

    • Locate the "Select PHP Version" icon under the "Software" section and click on it:



  3. Choose the PHP Version:

    • From the drop-down menu, choose the desired PHP version. The available versions will be listed, typically ranging from older versions to the latest stable release:



  4. Set the PHP Version:

    • Click on the "Apply" button next to "Current PHP version" to apply the selected PHP version to your hosting account.
  5. Check for PHP Version Overriding via MultiPHP Manager

    • The PHP version selected on the "Select PHP Version" page is the account's default PHP version. The PHP version can be overridden for specific add-on domains and sub-domains on the "MultiPHP Manager" page. An add-on domain or sub-domain that has a different PHP version selected will appear with the orange cPanel icon under the "Handled By" column, as in this example:



    • To allow the respective add-on domain or sub-domain to use the PHP version selected on the current "Select PHP Version" page, please click on the "Use PHP Selector" button next to it under the "Action" column.
  6. Optionally: Customize PHP Extensions and Options:

    • You can customize specific PHP settings under the "Extensions" and "Options" tabs. There you can enable/disable PHP extensions and modify PHP configuration settings like memory limit, maximum execution time, etc.:



    • On the "Options" tab, you will see many PHP options that you can customise, such as upload_max_filesize, post_max_size, max_input_vars, memory_limit, allow_url_fopen and many others. If there is a PHP variable that isn't on the list and you'd like to see it there, please contact our support team and request it.

    • The default PHP extensions and settings should normally be optimal for most sites and web applications.

    • To assure that the current default extensions are applied to the selected PHP version, please navigate to the "Extensions" tab and click on the "Reset to default" button:



    • Please avoid selecting PHP extensions that your site doesn't necessarily need.
  7. Recommended: Repair the MySQL Database:

    • Different PHP versions work in conjunction with different MySQL database drivers. If your website is displaying a 404 error or content is missing, please repair the MySQL database.
    • Repairing the database will only take a moment, does not require advanced technical knowledge, and should normally not harm your website in any way.
    • Here's how you can repair MySQL databases: Repairing MySQL Databases in cPanel
  8. Verify the Changes:

    • It’s a good practice to verify the PHP version change by trying to access your website.
    • If you notice any errors, such as "500 Internal Server Error", please refer to this guide: Troubleshooting a broken website after switching PHP version
    • You can create a phpinfo.php file temporarily containing <?php phpinfo(); ?> in the root directory of your domain and access it via your web browser. This will display the current PHP version and configuration details.
    • If you encounter any issues, please revert back to the old PHP version and settings. Should the issue persist, please contact our support team for assistance.

Using the cPanel MultiPHP Manager

MultiPHP Manager is another powerful tool within cPanel that allows you to manage PHP versions across your domains. It is particularly useful for environments not using CloudLinux OS, or for add-on domains and sub-domains that need to run a different PHP version.

Step-by-Step Guide:

  1. Navigate to MultiPHP Manager:

    • Find and click on the "MultiPHP Manager" icon under the "Software" section:



  2. Select the Domain:

    • You will see a list of your domains. Select the checkbox next to the domain(s) for which you want to change the PHP version.
  3. Choose the PHP Version:

    • From the drop-down menu at the top right corner labeled "PHP Version", select the desired PHP version.
    • If you select "inherit" as the PHP version, the default PHP version mentioned under "System PHP Version" will apply.
      • Please Note: If you have selected a different PHP version under the "Select PHP Version" page, that version will apply instead for all domains that have "inherit" selected.
  4. Apply the PHP Version:

    • Click the "Apply" button to set the chosen PHP version for the selected domain(s):



  5. Recommended: Repair the MySQL Database:

    • Different PHP versions work in conjunction with different MySQL database drivers. If your website is displaying a 404 error or content is missing, please repair the MySQL database.
    • Repairing the database will only take a moment, does not require advanced technical knowledge, and should normally not harm your website in any way.
    • Here's how you can repair MySQL databases: Repairing MySQL Databases in cPanel
  6. Verify the Changes:

    • It’s a good practice to verify the PHP version change by trying to access your website.
    • If you notice any errors, such as "500 Internal Server Error", please refer to this guide: Troubleshooting a broken website after switching PHP version
    • You can create a phpinfo.php file temporarily containing <?php phpinfo(); ?> in the root directory of your domain and access it via your web browser. This will display the current PHP version and configuration details.
    • If you encounter any issues, please revert back to the old PHP version and settings. Should the issue persist, please contact our support team for assistance.

Differences Between CloudLinux PHP Selector and cPanel MultiPHP Manager

Understanding the differences between CloudLinux PHP Selector and cPanel's MultiPHP Manager is crucial for selecting the right tool for your needs:

CloudLinux PHP Selector (the "Select PHP Version" page in cPanel)

  1. Availability:

    • Specifically designed for servers running CloudLinux OS.
    • All our web hosting and reseller hosting servers generally run this operating system and should have PHP Selector available.
    • VPS and dedicated servers do not have PHP Selector available if they are running AlmaLinux or other operating systems.
  2. PHP Versions:

    • Offers a wider range of PHP versions, including some that may be older than the versions that are officially supported by the PHP project.
    • Does not allow selecting PHP versions on a per-domain basis (only account-wide).
  3. Customization:

    • Provides extensive customization options for PHP settings and extensions.
  4. Security and Stability:

    • Enhanced security and stability features provided by CloudLinux.
    • Many older PHP versions that have reached "end of life" still receive backported security patches from CloudLinux.

cPanel MultiPHP Manager

  1. Target Audience:

    • Suitable for servers running cPanel, including those using CloudLinux.
  2. PHP Versions:

  3. Customisation:

    • The options are significantly more limited compared to CloudLinux PHP Selector. The PHP extensions and options cannot be customised using the MultiPHP user interface.

Conclusion

Both CloudLinux PHP Selector and cPanel's MultiPHP Manager offer user-friendly interfaces and efficient ways to manage PHP versions for your domains. By following the steps outlined above, you can quickly change the PHP version to meet your application's requirements. Understanding the differences between these tools helps you choose the right one based on your server environment and specific needs. 

In your cPanel control panel you can manage the PHP settings for your website, including the PHP version, PHP extensions, and custom PHP variables like memory_limit and max_input_vars.
Many known PHP settings can be managed via the cPanel control panel on the "Select PHP Version" page, without the need to manually create a php.ini configuration file.

Updated by SP on 07/08/2024

Was this answer helpful? 281 Users Found This Useful (615 Votes)