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.

 

  • 32 Users Found This Useful
Was this answer helpful?

Related Articles

How to Create a Redirect for Your Website

The redirect option is available in your cPanel. Login to your cPanel and click Redirect for...

How to Update a Cronjob E-mail Address?

If you want to receive a cronjob error or notification, you can update your e-mail address from...

Becoming Familiar and Navigating Around in cPanel

Lets learn about cPanel, and how to navigate it's many pages and functions. Making sure that your...

How to Increase PHP Upload Limit, Memory & Post Max Size

In some cases, default server settings may not let you upload larger files via your website, or...

How to add a MX Record in cPanel using DNS Zone Editor?

A mail exchanger record (MX record) is a type of resource record in the Domain Name System that...