How to upgrade php version cpanel

This article describes how to change the PHP version and additional PHP settings in cPanel.

Changing the PHP version

A2 Hosting servers support multiple versions of PHP. To change the PHP version used for your account, follow these steps:

  1. Log in to cPanel.

    If you do not know how to log in to your cPanel account, please see this article.

  2. Open the PHP Selector:
    • If you are using the Jupiter theme, on the Tools page, in the Software section, click Select PHP Version:

      How to upgrade php version cpanel

    • If you are using the Paper Lantern theme, in the SOFTWARE section of the cPanel home page, click Select PHP Version:

      How to upgrade php version cpanel

    If you do not see the Select PHP Version icon, your server does not support this feature. 

  3. cPanel displays the current PHP version. To change the PHP version, in the Current PHP Version list box, select the version that you want to use, and then click Set as current. The new PHP version takes effect immediately.

Changing PHP settings

In addition to changing the PHP version from cPanel, you can change various PHP settings. You can enable and disable PHP extensions, as well as configuration directives such as allow_url_fopen, error_log, and many more.

This feature removes the need to configure and maintain custom php.ini files. Instead, you control all PHP settings directly from cPanel.

To change your PHP settings, follow these steps:

  1. Log in to cPanel.

    If you do not know how to log in to your cPanel account, please see this article.

  2. Open the PHP Selector:
    • If you are using the Jupiter theme, on the Tools page, in the Software section, click Select PHP Version:

      How to upgrade php version cpanel

    • If you are using the Paper Lantern theme, in the SOFTWARE section of the cPanel home page, click Select PHP Version:

      How to upgrade php version cpanel

    If you do not see the Select PHP Version icon, your server does not support this feature. 

  3. On the Extensions tab, select which extensions you want to enable for the current PHP version:

    • To enable an extension, select the check box next to the extension name.
    • To disable an extension, clear the check box next to the extension name.

      How to upgrade php version cpanel

    • Selections are saved automatically.

    To reset the extension list to the default configuration, click Reset to default in the top right corner.

  4. To change settings for the current PHP version:

    • Near the top of the page, click the Options tab.
    • Click the value next to the setting that you want to modify.
    • Depending on the type of setting, a list box may appear with predefined settings that you can choose. Or, a text box may appear so you can type the value:

      How to upgrade php version cpanel

    • Changes are saved automatically, and take effect immediately.

    When you modify a setting, a Reset to default link appears beneath the setting label. Click the link to change the setting back to the default value.

In some cases, the correct functioning of your website depends on a PHP version installed on the server.
This guide describes how to change php version on Shared servers (Stellar, Stellar Plus plans and old Value, Professional, Ultimate plans). For Business SSD servers, use this guide.

Thanks to the PHP Selector function, it is possible to select the necessary PHP version as well as enable/disable certain PHP modules and functions.

To check what PHP version is currently in use, refer to this article.

  • Change PHP version and/or manage extensions
  • Update PHP options
  • Change PHP version for addon domain

Change PHP version and/or manage extensions

1. Log into your cPanel account.

2. Scroll down to the Exclusive for Namecheap Customers section >> Select PHP Version:

For cPanel Basic Theme:


How to upgrade php version cpanel

For cPanel Retro Theme:

3. Here you will see the list of available modules and extensions.

If you do not need to change the PHP version and just want to turn on/off specific extensions, you can do this by checking/unchecking the corresponding boxes.

Use the Current PHP version drop-down box to select the required version and click on Set as current in order to apply the changes.

How to upgrade php version cpanel

4. To change individual settings within the PHP version in question, click on the Options tab.

By clicking on one of the options in blue, you will be presented with a drop-down list to change specific settings:

How to upgrade php version cpanel

NOTE: In order to increase the max upload size, make sure to modify both post_max_size and upload_max_filesize values.

Sometimes your website may need to use a different PHP version from the one assigned to your whole cPanel account.

To set a different PHP version for an addon domain, you need to add a special code to your .htaccess file. To do this, follow the steps below.

1. Find the .htaccess file for the addon domain in question. The steps for how to find it can be located here.

2. Add the following line to your .htaccess file:

<FilesMatch ".(?:html|php)$">
SetHandler application/x-lsphpXX
</FilesMatch>

For servers with LiteSpeed the code should be the following:

<FilesMatch ".(?:html|php)$">
SetHandler application/x-httpd-alt-phpXX
</FilesMatch>

where XX is the PHP version you wish to set. It can be 52, 53, 54, 55, 56, 70, 71,72, 73, 74, 80 or 81.

For example:

How to upgrade php version cpanel

3. Click “Save changes”.        

NOTE: When a different PHP version is set for the addon domain, there are no PHP extensions enabled by default. To make a website work correctly, you will need to upload a php.ini file to the folder of the addon domain. You can check this article (see point 6) to help you with uploading files to the hosting account.

You need to download the php.ini file for different PHP versions from the Attachments section at the end of this guide. Do not forget to rename the file to php.ini once it is uploaded to the hosting account.

Alternatively, you can run the command below via SSH:

cp /opt/alt/default_php_ini/phpXX.ini /home/cPanel_username/path_to_the_folder/php.ini

  • XX is PHP version you wish to set (it can be 52, 53, 54, 55, 56, 70, 71, 72, 73, 74, 80 or 81),
  • cPanel_username should be replaced with your actual cPanel username, and
  • path_to_the_folder is a path to the folder of the addon domain.

For example:

How to upgrade php version cpanel

You can find details on how to access a hosting account via SSH here.

The process is similar if you wish to set a different PHP version for a subdomain.

When php.ini is created, make sure to add lsapi_phpini directive to .htaccess to activate the file.

That's it!

Need any help? Contact our HelpDesk

How do I update PHP 7.4 in cPanel?

How to upgrade PHP if you are on Kinsta Web hosting?.
Select your site..
Click on Tools from left sidebar..
Choose PHP Engine..
Click on Modify..
And Select PHP 7.4..

How do I upgrade my PHP version?

How do I change the PHP version?.
Log in to your one.com control panel..
Scroll down to the Advanced settings tile and select PHP and database settings..
Scroll down to Update PHP version..
Select the PHP version you want to switch to and click Update..

How do I update PHP version in cPanel WHM?

Procedure.
Log into WHM..
Navigate to EasyApache 4..
Click Customize under Currently Installed Packages..
Click PHP Versions..
Mark the version for installation by clicking the switch icon to the far right of the version..
When prompted, click the option to only install the PHP version or the PHP version and extensions..

How do I change my default PHP version in cPanel?

To change the system default PHP, perform the following steps: Click Edit in the System PHP Version section. Select your desired PHP version from the menu. Click Apply .