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:
- You have a cPanel account with a hosting provider.
- You have SSH access to your server (optional, but recommended).
Method 1: Using cPanel
- Log in to your cPanel account.
- Click on the Software section and then select MultiPHP INI Editor.
- In the MultiPHP INI Editor page, select the domain or subdomain for which you want to change the PHP version.
- Click on the Switch to PHP Version dropdown menu and select the desired PHP version from the list.
- Click Save to apply the changes.
Method 2: Using SSH (Recommended)
- Connect to your server using SSH.
- Navigate to the
/usr/local/php
directory using the commandcd /usr/local/php
. - List the available PHP versions using the command
ls
. - Identify the PHP version you want to switch to and note its directory name (e.g.,
php71
for PHP 7.1). - Switch to the new PHP version using the command
sudo /usr/local/php/php71/bin/update-php
(replacephp71
with the actual directory name). - Verify that the PHP version has been updated using the command
php -v
.
Additional Tips:
- If you're using a custom PHP version, you may need to update the
php.ini
file manually. - Some PHP extensions may not be compatible with the new PHP version. Be sure to check the compatibility before making the switch.
- If you're using a third-party application that relies on a specific PHP version, you may need to update the application or contact the developer for support.
Remember to test your website and applications after changing the PHP version to ensure everything is working as expected.