How to change php version in cpanel

Changing the PHP version in cPanel is a relatively straightforward process. Here's a step-by-step guide:

Prerequisites:

  1. You have a cPanel account with a hosting provider.
  2. You have SSH access to your server (optional, but recommended).

Method 1: Using cPanel

  1. Log in to your cPanel account.
  2. Click on the Software section and then select MultiPHP INI Editor.
  3. In the MultiPHP INI Editor page, select the domain or subdomain for which you want to change the PHP version.
  4. Click on the Switch to PHP Version dropdown menu and select the desired PHP version from the list.
  5. Click Save to apply the changes.

Method 2: Using SSH (Recommended)

  1. Connect to your server using SSH.
  2. Navigate to the /usr/local/php directory using the command cd /usr/local/php.
  3. List the available PHP versions using the command ls.
  4. Identify the PHP version you want to switch to and note its directory name (e.g., php71 for PHP 7.1).
  5. Switch to the new PHP version using the command sudo /usr/local/php/php71/bin/update-php (replace php71 with the actual directory name).
  6. Verify that the PHP version has been updated using the command php -v.

Additional Tips:

Remember to test your website and applications after changing the PHP version to ensure everything is working as expected.