How to update PHP version in WordPress?

The backend of WordPress sites is handled by PHP and MySQL. When a new version of the Hypertext Preprocessor is launched, a user using an older edition of the software may want to update it so that the WordPress site can benefit from the improvements. Why update? Newer versions of the Hypertext Preprocessor are better than their older version. For example, there’s a massive difference between the performance of PHP 5.x and 7.x. Thus, the performance of web applications powered by PHP 7.x will be better than that powered by the older editions of the Hypertext Preprocessor i.e. 5.x and below.

Updating the PHP version on a shared hosting plan is very easy. Shared plans ship with cPanel, a software that lets you manage files, databases, redirects, etc. If your host supports the latest edition of PHP, you can change the version to the current one with the help of the cPanel tool. In case your host offers WHM instead of cPanel, you can change the PHP version with the help of GUI.

If your sites are hosted on a VPS and you don’t have the license of cPanel or WHM, you can update the scripting language by running Linux commands. For example, to update the Hypertext Preprocessor on Fedora, you can run the command sudo dnf check-update to see if PHP’s latest version is in the official repo or not. If the list of packages that you can upgrade contains PHP, you must run the command sudo dnf update. This command will not only update the Hypertext Preprocessor but also update every outdated package on your system.

Note: Before running any command, backup the config files, as the updater might overwrite the file with the sample one. If this happens, your application won’t be accessible, and you will have to recreate the config file from scratch (make changes to the sample file).

Should you update the PHP version? Yes, but when a new version of PHP is available, you should wait for the developer of the theme and plugins that are active on your site to confirm that their plugin or theme will work with the new version of PHP. If you don’t do so and if there’s a change in the Hypertext Preprocessor’s function that the theme/plugin uses, your site may break or might show errors to the website visitors.

Closing words: As you can see above, updating the Hypertext Preprocessor on a shared hosting plan is very easy. If something goes wrong after changing the PHP version, you can quickly switch to the older edition of PHP on a shared host. You will have to be careful while updating software on a VPS server, especially the unmanaged VPS. Before updating, you should check if the theme/plugin works with the latest edition of the scripting language.


Pramod is the founder of wptls. He has been using WordPress for more than nine years. He builds web applications, and writes about his experiences with various WP products on this site.

Leave a Reply

Your email address will not be published. Required fields are marked *