A Web.com Partner
Sign Up / Log In
Online Support Web Hosting

How to change your PHP version in cPanel Hosting

If you're running a website, you may encounter situations where you need to change the PHP version. Whether it's for performance optimization or compatibility reasons, cPanel provides a straightforward way to manage PHP versions for your hosting as well as individual domains. In this guide, we'll walk you through the process.


Table of Contents


Change the PHP Version of Your Entire cPanel Hosting


Many third-party applications will require different PHP versions so you may want to switch to another version for a particular project. You can perform this modification in your Hosting Manager control panel.

WARNING:
Changing the PHP version of your entire cPanel hosting affects all websites of the addon domains and subdomains hosted in it.

To change your PHP version, follow the steps below:
  1. Access the cPanel of your hosting.
  2. Scroll down to Software.
  3. Click the Select PHP Version button, which is next to Installatron Applications Installer.
    Select PHP Version Option in cPanel Homepage
  4. On the Select PHP Version page, select the PHP Version you want from the drop-down menu. Then, click Apply.
    Image of PHP Version Drop-down and Apply Button

Your PHP version will be updated instantly. To check if the changes has taken effect, you can check the Current PHP version at the top of the same page as shown in the screenshot below.
Current PHP Version as Shown in Select PHP Version page


Change the PHP Version of One Domain or Subdomain on a Hosting


Follow the steps below if you only want to change the PHP version of one addon domain or subdomain. This guide applies to cPanel accounts that host multiple websites and domains.

IMPORTANT:
This process involves editing the .htaccess file of your website that may result in a downtime of your website if done incorrectly. It is best to ask your website developer to follow the suggested steps below.

  1. Access your cPanel.
  2. Under Files, click File Manager.
  3. Create and view your phpinfo.php page to compare the PHP version before and after completing this guide.
  4. Edit the .htacccess file of the website in question. If you can’t see the .htaccess file, show .htaccess (hidden files) within the File Manager.

    TIP:
    If you still can’t see the .htaccess file even after showing the hidden files, create a .htaccess file.

  5. Enter the code that corresponds to the PHP version you want to apply based on the table below.
    PHP Version Code
    5.5 <IfModule mime_module> AddHandler application/x-httpd-ea-php55___lsphp .php .php5 .phtml </IfModule>
    5.6 <IfModule mime_module> AddHandler application/x-httpd-ea-php56___lsphp .php .php5 .phtml </IfModule>
    7.0 <IfModule mime_module> AddHandler application/x-httpd-ea-php70___lsphp .php .php7 .phtml </IfModule>
    7.2 <IfModule mime_module> AddHandler application/x-httpd-ea-php72___lsphp .php .php7 .phtml </IfModule>
    7.4 <IfModule mime_module> AddHandler application/x-httpd-alt-php74___lsphp .php </IfModule>
    8.0 <IfModule mime_module> AddHandler application/x-httpd-alt-php80___lsphp .php </IfModule>
    8.1 <IfModule mime_module> AddHandler application/x-httpd-alt-php81___lsphp .php </IfModule>
    8.2 <IfModule mime_module> AddHandler application/x-httpd-alt-php82___lsphp .php </IfModule>

    Add the code to the topmost part of the page if there are existing codes in the .htaccess file.

  6. Click Save Changes on the file editor.
    Location of Save Changes Button Inside the Code Editor of File Manager in cPanel
  7. View the changes in your phpinfo.php file that you created in Step 2 by adding /phpinfo.php after your domain name. It should be similar to this URL: https://yourdomain.com/phpinfo.php when accessing it via your browser.
Was this helpful? Yes No 72% of people found this helpful.