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
To select a different PHP version, select the appropriate version from the drop-down list and press Set as current button.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: 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. Also see:
How To Fix Your Connection To This Site Is Not Secure ErrorFix: Unable To Download Any EXE File In Windows 10How To Fix Error Code 0x80070666 While Installing Microsoft Visual C++ Redistributable9 Easy Ways To Fix Flash player not working in chromeFix Code 52 Error Unable to Verify the Digital Signature of Drivers in Windows 10/11