How to Change Your PHP Version

In some cases, default server settings may not be suitable for your website configuration and setup. Sometimes you may need to change your PHP version to resolve some errors. This tutorial shows how to change your PHP version in cPanel.


What you’ll need

Before you begin this guide you’ll need the following:

- Access to your hosting account’s cPanel

 

Step 1 — Opening up PHP Settings

Log in to your cPanel and navigate to Select PHP Version:

Select PHP Version
You will now come to this screen:

Select PHP Version

Step 2 — Selecting Your PHP Version

Section 2 in the image above is where you can change your PHP version. Once you have selected one, make sure to click 'Set as Current'. Then just click Save at the bottom.

Do you have a single domain or wish to use  different PHP version per folder? Do you have an installed PHP 5.x software in a folder/blog and want to use a PHP 7.x instead? If so, you can do this using cPanel and the .htaccess file.

You can also set the version per domain using .htaccess.

The best way to change the version of PHP used for requests to your website is to add one of the following lines to your .htaccess file. One major convenience of this method is that you can change the PHP version for individual directories.

PHP 7.4
AddHandler application/x-httpd-php74 .php

PHP 7.3
AddHandler application/x-httpd-php73 .php

PHP 7.2
AddHandler application/x-httpd-php72 .php

PHP 7.1
AddHandler application/x-httpd-php71 .php

PHP 7.0
AddHandler application/x-httpd-php70 .php

PHP 5.6
AddHandler application/x-httpd-php56 .php

PHP 5.5
AddHandler application/x-httpd-php55 .php

PHP 5.4
AddHandler application/x-httpd-php54 .php

PHP 5.3
AddHandler application/x-httpd-php53 .php

Conclusion 

You have now learnt how to change your PHP version in cPanel. We recommend using either 7.2 - 7.4 for the best results however, depending on the age of your website or script, you may need to choose an older version for it to function correctly. 

Note that these settings can solve most issues you are facing with your website after initial transfer or setup. You may also need to look at your website HTML/PHP code also depending on the issue you face.

 

  • 35 Users Found This Useful
Was this answer helpful?

Related Articles

How to update your cPanel Contact Information or receive a notification on reaching quota limit?

If you want to receive notification on reaching your disk quota, bandwidth usage limit, reaching...

How to Change cPanel Style/Theme?

Switching over to another cPanel theme with a different style is easy and there are two ways to...

How to Edit file in the cPanel File Manager?

1. Log into your cPanel account.2. In the "Files" section, click on "File Manger" Icon. 3....

How to Change Language of your cPanel?

cPanel supports a lot of languages, and if you want to change your cPanel language to your native...

How to Reset my cPanel Account Password?

If you can access your cPanel account, follow these steps to reset your password:1. Log into your...