PHP is one of the most widely used scripting languages, close to 85% of websites on the Internet use it.  With that being said, most website owners don’t know how to change the version of PHP their website uses.  This guide will show you how to change the PHP version for your website and some basic troubleshooting tips if you run in to issues.

Why you should use the latest version of PHP on your website

PHP 5 was released in 2014 and has received several updates over the years.  PHP 5.6 continues to receive security updates but this ends in December of 2018.  If you’re currently using PHP 5.6 it’s highly recommended to update to PHP 7 before the end of the year to ensure you’re running the latest version.  Using the latest version of PHP means you’ll receive updates in the form of bug fixes, code improvement, stability and security patches.

If you use WordPress and switch to PHP 7 you’ll notice a performance improvement up to 20% over PHP 5.  PHP 7 is two times faster than PHP 5.6 when it comes to overall performance  with improvements in memory usage specifically.  If you’re using WordPress it’s a no-brainer that PHP 7 will make your website load faster then any previous versions of PHP.

Below is a table showing currently supported PHP versions and when they will stop receiving updates:

PHP Versions

Is It Safe To Update Your PHP Version to 7

Before you upgrade to PHP 7 you’ll want to make sure any scripts, themes and plugins your website uses are compatible.  A default WordPress installation is compatible with PHP 7.2 however your theme or plugins may not be.  If you’re unsure if your website is compatible with PHP 7 it’s best to ask your developer.  With that being said, if you upgrade to PHP 7 and your site is blank or shows an error message you can easily switch back to your current version.

How To Change PHP Versions in cPanel

At HostUpon we’ve made it simple to change PHP versions with a few clicks.  You can follow the steps below to change PHP versions in cPanel:

Step 1.  Login to your cPanel control panel by visiting yourdomain.com/cpanel and entering your username and password.

Step 2.  Look for the icon labelled Select PHP Version under the Software category.  You can also use the search box in the top right corner.

Select PHP Version in cPanel

Step 3.  You should now see your current version of PHP and a drop-down menu with a list of supported PHP versions.  The default version is currently 5.4 however in the drop-down you’ll have the option of choosing from PHP 5.2, 5.3, 5.4, 5.6, 7.0, 7.1 and 7.2.

Choose PHP version

 

Step 4.  Select PHP 7.2 if you wish to use the latest version of PHP and then hit the Use Defaults button in the bottom left.  Then hit the Save button.

PHP 7.2

Step 5.  Now it’s time to test your website to see if it’s compatible with PHP 7.2.  Simply visit your website in a new tab in your browser.  If your website loads without any error messages present then your website is compatible and no further action is required.  If you see an error message or if you’re seeing a blank white page then that means your website is not compatible with PHP 7.2.  In this case you would go back to the cPanel and select your previous PHP version and hit save.

What to do if your website is not compatible with PHP 7

If you switched to PHP 7 and see an error on your website it will likely tell you which plugin or theme is the culprit.  If it’s a plugin, you can try to disable it to see if that solves the issue.  If it’s related to your theme then you’ll need to contact the theme developer to see if their is a new theme update that is compatible with PHP 7.

If you see a blank white page then you’ll need to check the error_log file located in the public_html folder of your website.  The error_log will show you PHP errors and what is causing them.  You’ll need to resolve the errors in order to use PHP 7 with your website.  Remember, you can always go back to your previous version of PHP using the Select PHP Version icon inside cPanel.

Since PHP 5 will no longer receive security updates after December of 2018, it’s best to get started now and update your scripts, themes and plugins if they aren’t compatible.

Conclusion

With so many websites using PHP as their scripting language it’s become a target for hackers who look for exploits in older PHP versions.  Staying current with PHP versions is a critical component to website maintenance and security.  At HostUpon, we want to ensure our customers are running the latest PHP version and the Select PHP Version tool inside cPanel does just that.  You can control the version of PHP your websites uses along with enabling or disabling PHP modules you may need.

If you have any questions about changing the PHP version your account uses you can always reach out to our support team via Live Chat or by opening a support ticket.