The development team releases a new version of PHP about once a year. Unfortunately, you can’t update your website to a new PHP version from the WordPress admin dashboard. As a server-side coding language, the PHP software is installed on your website’s server. Your website will still have PHP files, but the software used to interpret these files are found on your site’s server. To update your website’s PHP version, you’ll have to update this server software.
The Basics of PHP in WordPress
WordPress uses PHP to fetch content in real time from an SQL database. All WordPress websites have an SQL database. Consisting of tables with records and fields, it contains most of your site’s text content. The text from your website’s posts, pages, comments, authors, tags and categories are stored in an SQL database. WordPress uses PHP to retrieve this content and present it in HTML.
Your website is essentially built each time a visitor loads it. When a visitor loads your website, WordPress will retrieve the requested content from your site’s SQL database. PHP is the coding language that allows WordPress to communicate with your website’s SQL database so that it can serve the requested content to the visitor in HTML.
Why You Should Update Your Website’s PHP Version
Updating your website’s PHP version will protect it from cyber threats. The development team only supports each version for three years. They offer full support for the first two years, followed by an additional year of limited support. At the end of this three-year period, developers will no longer patch bugs and security vulnerabilities. For the highest level of security, you should update to a new PHP version that’s still supported by developers.
Your website’s load times may decrease if you update its PHP version. On its support page, in fact, WordPress says that the latest version of PHP is three to four times faster than older, depreciated versions of the server-side coding language. The latest version is better optimized. It features cleaner syntax with less bloat to promote faster loading.
With the latest PHP version, you can install new versions of WordPress on your website as well. New versions of WordPress are incompatible with old PHP versions. If you’re running an old version of WordPress and an old version of PHP, you must update the latter before you can update the former. Attempting to update WordPress while running an old PHP version will typically result in an error message.
Begin With a Backup
Before updating your website’s PHP version, create a backup. Changing the PHP version won’t affect your website’s content. It will only affect the PHP software that’s installed on your website’s server. Nonetheless, it’s a good idea to begin with a backup in case something goes awry. If you accidentally delete any files during the update, you can restore your website using the backup copy.
Update Plugins and Theme
From the WordPress admin dashboard, update your website’s theme and all of its plugins. Old versions of themes and plugins may be incompatible with new PHP versions. If you only update the PHP version, your website’s theme or its plugins may break.
Log in to Your Control Panel
When you’re ready to update the PHP version, log in to the control panel associated with your web hosting account. Most web hosting services use cPanel. It’s a web-based interface that provides server and website management features. Assuming your web hosting account uses cPanel, you should be able to access it by visiting your website’s domain, followed by a forward slash and then “cpanel.”
Perform the Update
Now it’s time to update your website’s PHP version. With dozens of icons and menu links, control panels can be intimidating. Furthermore, many web hosting services customize their clients’ control panels, resulting in different layouts from host to host. You can usually find the option to update PHP, though, simply by searching for “PHP.”
While on the control panel’s home screen, enter “PHP” in the search box at the top of the page. Doing so will filter most or all non-PHP icons. Look for an icon labeled “PHP Selector” or “MultiPHP Manager and click it.
Some control panels use PHP Selector, whereas others use MultiPHP. They both allow you to change the PHP version of your website. The only real difference is that PHP Selector applies the PHP update to your entire web hosting account. In comparison, MultiPHP Manager allows you to update websites individually. If you have two websites on your web hosting account, for instance, you can use MultiPHP Manager to update one of your site’s PHP version while retaining the old PHP version on the other site.
In PHP Selector or MultiPHP Manager, look for a drop-down menu featuring the PHP versions supported by your web hosting service. After clicking this menu, select the latest available PHP version. You can then apply the update to your entire web hosting account or an individual website on your account, depending on whether you use PHP Selector or MultiPHP Manager.
Your website should now run the latest version of PHP offered by your web hosting service. To ensure the update worked, visit your website and navigate to some of its posts or pages. If the update broke your website, try changing it to a different PHP version, such as the second-latest version.
Research conducted by WP Engine shows that nearly one in five WordPress websites run an outdated PHP version. If your website among this crowd, you should update it. Updating to a new PHP version will make your website faster and more secure while also giving you the freedom to install new versions of WordPress on it.