How to Update PHP in WordPress
To protect yourself from malware or broken features
WordPress is built around the PHP scripting language, so it’s pretty essential to have an up-to-date version of it installed on your web server. It’s easy tokeep WordPress up-to-dateitself, but the core technologies (like PHP) aren’t always in sync with your installed WordPress version.
This is especially true for DIY web servers that you’ve set up yourself. If the server hosting your site isn’t updated, PHP isn’t likely to be either, which could leave your site exposed to exploits or broken features. That means you’ll need to update PHP to keep things running—here’s how to update PHP in WordPress.
Check Your Current PHP Version
From time to time, the minimum supported version of PHP that WordPress supports changes. You can check the current minimum version at theWordPress website, but as of publication, WordPress currently supports a minimum of PHP 7.3 or greater.
Not all web servers will be running PHP 7.3 or greater, however. Older PHP versions will still work with WordPress, but it may cause newer themes, plugins, and features to break.
To make sure you’re running the correct PHP version, you can check your current WordPress installation using theSite Healthmenu in WordPress 5.2 and later.
You can also check your PHP version using third-party plugins such asPHP Compatibility Checker. If your PHP version is out-of-date, you’ll need to move to upgrade it as soon as possible.
Backup Your Site & Prepare To Upgrade
Updating a core component like PHP can break your site. Before you rush to update PHP in WordPress, the best thing to do isbackup your WordPress siteand prepare to upgrade it first.
You should start by making acopy of your MySQL databaseand make physical copies of your WordPress files. Many WordPress hosting providers will offer built-in backup services that you can take advantage of, so be sure to check with your web host if this is the case.
For DIY servers, it’s on you—you’ll need to back it up manually. If you’re afraid of hitting the terminal, use a plugin likeUpdraftPlusto make regular backups of your WordPress installation automatically. UpdraftPlus can store your backups off your server, taking advantage of cloud storage services like Google or Microsoft Azure.
If your WordPress site is backed up, then you’re prepared to take the plunge and begin updating PHP in WordPress.
Switching PHP Versions In WordPress Using cPanel
Many web hosting services use the cPanel web hosting control panel system to allow you to control and make changes to your web hosting. For shared hosting, where you share your webspace with other users, you may not be able to update PHP in WordPress at all, but you may be able to switch to a newer version if it’s available.
If it isn’t, speak with your hosting provider directly about updating PHP to the latest version. If it is, cPanel allows for a quick-and-easy way to switch to newer versions of critical server software like PHP.
Because cPanel is modular, these settings may vary, depending on your own cPanel version.
The PHP version running on your server should change immediately. Other web host control panels do exist and may support similar functionality—if they don’t, and you have access to your web server directly, you can update PHP manually.
Updating PHP Manually From a Terminal Or SSH Connection
This option can and should only be used by users who have backed up their site and who feel comfortable using a Linux terminal. Most web servers run Linux, but if you have a Windows IIS server, you can update PHP in WordPress using theWeb Platform Installerinstead.
As we’ve mentioned, it’s essential that you have a backup of your WordPress site before you begin. It’s also worth testing the latest PHP version on a test version of WordPress on a separate server and installation to make sure that your plugins, themes, and overall WordPress setup works with it correctly before you update your main server.
For non-Apache installations, consult your web server software’s documentation to update the PHP version used for your server configuration, as well as to install additional PHP modules (plugins) for your version of PHP.
Once PHP has been updated, your web server settings have been changed to use the new version, and your web server has been restarted, your WordPress site will begin using it.
Keeping Your WordPress Site Secure
WordPress is the core of millions of sites worldwide, and like other web administrators, you need to keep your WordPress site secure. Now you know how to update PHP in WordPress, you should run a full security audit—if your site has holes, you may haveWordPress malwarethat you’ll need to remove.
If you’re new to WordPress, here are someessential WordPress pluginsto get your site up and running quickly. Let us know your WordPress security tips in the comments section.
Ben Stockton is a freelance technology writer based in the United Kingdom. In a past life, Ben was a college lecturer in the UK, training teens and adults. Since leaving the classroom, Ben has taken his teaching experience and applied it to writing tech how-to guides and tutorials, specialising in Linux, Windows, and Android. He has a degree in History and a postgraduate qualification in Computing.Read Ben’s Full Bio
Welcome to Help Desk Geek- a blog full of tech tips from trusted tech experts. We have thousands of articles and guides to help you troubleshoot any issue. Our articles have been read over 150 million times since we launched in 2008.
HomeAbout UsEditorial StandardsContact UsTerms of Use
Copyright © 2008-2024 Help Desk Geek.com, LLC All Rights Reserved