Fix Unable to Change PHP Version on cPanel

PHP version selectorPHP version selector

Most of the cPanel hosting providers offer a lot of features including the ability to run multiple versions of PHP on the same shared hosting. There are times when you want to run your application on a specific PHP version due to compatibility or any other reason.

I have been working with cPanel control panel for a long time. One of the issues I encountered lately was that I was unable to change the PHP version on my cPanel hosting no matter what I did. The PHP version will get changed but will revert once I refresh the cPanel page.

This article discusses exactly how I fixed this issue.

Let’s first take a look at how to change the PHP version on cPanel. This is standard practice for all hosts providing cPanel hosting including GoDaddy, Hostgator, a2hosting etc.

Changing the PHP version on cPanel

  1. Login to your cPanel account. 
  2. Go to the Software section and click on “Select PHP Version“.
  3. The next page will show the current PHP version. You can see the PHP versions currently installed on your system in the drop-down list.
How To Customize Windows 10, 11 Wit...
How To Customize Windows 10, 11 Without Activating It
Select PHP Version option in cPanel
Select PHP Version option in cPanel

To select a different PHP version, select the appropriate version from the drop-down list and press Set as current button.

PHP version selector
PHP version selector

This should be changed to the PHP version immediately. There will be no downtime.

To confirm that your changes have taken effect, create a PHP page in the root directory of your hosting with the following code:

<? phpinfo(); ?>

Now open the page in a browser and you will get the information about your PHP configuration. For example, if I created a page called checking-php-config.php on itechtics.com, I would open it as https://www.itechtics.com/checking-php-config.php.

Once confirmed, please delete this page as showing your configuration publicly is risky.

Fix PHP selector not changing PHP version in cPanel

As discussed above, changing the PHP version is fairly simple but there are times when PHP selector will not change the PHP version in cPanel no matter what you do. 

My site was running on the older version of PHP i.e., PHP 5.4 which became almost obsolete. Most new WordPress themes and plugins now require newer versions of PHP. I decided to upgrade my PHP to 7.0 to be on the safer side although 7.3 is also available.

Since I was on A2Hosting, I was using cPanel and used the same steps listed above to change the PHP version. But it would not stick to the new value.

After researching for some time, I got the problem. cPanel hosts use .htaccess file to save some PHP configurations. The issue was that I had changed the permissions of .htaccess file to be read-only for all users. So the system was also not allowed to write into the .htaccess file. 

Once I changed the file permissions of .htaccess file to 644, and changed the PHP version afterward, the new changes took effect immediately without reverting.

I hope this solution will help you fix your PHP version problems. Please share your experience with us in the comments below. We’ll be happy to help if your problem isn’t fixed yet.

If you liked this post, Share it on:

Get Updates in Your Inbox

Sign up for the regular updates and be the first to know about the latest tech information

Usman Khurshid
Usman Khurshid is a seasoned IT Pro with over 15 years of experience in the IT industry. He has experience in everything from IT support, helpdesk, sysadmin, network admin, and cloud computing. He is also certified in Microsoft Technologies (MCTS and MCSA) and also Cisco Certified Professional in Routing and Switching.

1 comment

  • Chris Beshore
    Chris Beshore

    Great post. My htaccess was already set to 644. But I noticed that when the PHP selector page loaded up, there was a pop-up in Chrome that said “translating”. Thought that was weird, so I disabled automatic translation in Chrome settings and then it worked. Maybe this will help someone.

Leave your comment