Blog

Update PHP on WordPress Safely

How to update PHP in WordPress safely: which versions are supported, what to check first, the backup to take, and what a rollback can't undo.

Part of: Restore, Recovery and Troubleshooting

How to update PHP in WordPress safely: a dashboard showing a PHP version upgrade with passed compatibility checks, a security shield, and a verified database backup with a rollback arrow

Switching PHP in WordPress takes about thirty seconds in most hosting panels. A dropdown, a Save button, done. What decides whether the day goes well is everything around that dropdown: whether a plugin written in 2019 still runs, whether you can get back to where you were, and whether a copy of the site exists that you haven't just broken.

This guide covers the order we'd work in: confirm which PHP versions are worth moving to, check your plugins and theme, take a backup you've verified, make the switch on your host, test the pages that earn money, and know exactly what a rollback does and doesn't undo. Where we cite a version number or a support date, it comes from the official PHP and WordPress pages, linked as we go. We have no customer numbers or test results to offer here, and we won't make any up.

Which PHP versions are still supported (and what WordPress recommends)

Start with the version you're on now, because it tells you how urgent this is. According to the supported versions page on php.net, as read on 17 November 2026, the picture looks like this:

  • PHP 8.2 is in security-fixes-only mode, with security support ending on 31 December 2026.
  • PHP 8.3 left active support on 31 December 2025. It gets security fixes until 31 December 2027.
  • PHP 8.4 is in active support until 31 December 2026, with security fixes until 31 December 2028.
  • PHP 8.5 was released on 20 November 2025. Active support runs to 31 December 2027 and security fixes to 31 December 2029.

Anything older than 8.2 is end of life. That means no more fixes of any kind, including security ones. If your site still runs 7.4, 8.0 or 8.1, this is no longer a "someday" job.

WordPress has its own opinion. The requirements page on wordpress.org says it's recommended your host supports PHP 8.3 or greater, and notes that WordPress still works with PHP 7.4 and up in a legacy environment, though those versions have reached end of life and may expose your site to security vulnerabilities. Read that carefully. "Works with" is a statement about WordPress core. It says nothing about the forty plugins sitting on top of it.

So which target? For most sites, one of 8.3 or 8.4 is the sensible landing spot. 8.3 clears WordPress's own recommendation and has security cover through the end of 2027. 8.4 buys another year on top of that. PHP 8.5 is out and supported, but a brand-new major version is where the long tail of plugin incompatibilities shows up first. If your plugins are all actively maintained, it's fine to aim there. If you're carrying a few abandoned ones, don't jump the whole way in one go.

One more habit worth building: jump one step at a time when the gap is large. Going from 7.4 straight to 8.4 stacks several versions' worth of removed features and stricter type handling into a single switch. When something breaks, you can't tell which version's change did it. Going 7.4 to 8.1, testing, then 8.1 to 8.3 is slower on paper and much faster the first time something throws an error.

First, find out what you're running now

Open Tools → Site Health → Info → Server in the WordPress dashboard. The PHP version is listed there, next to the web server and database versions. The Site Health documentation describes what else the screen reports.

Your host's control panel is the other source, and it's the one that matters, because that's where the change actually happens. Occasionally the two disagree, usually when a site has a per-folder override left in a .htaccess file from years ago. If Site Health says one thing and the panel says another, sort that out before touching anything.

Check plugins and theme before you switch

Almost every bad PHP upgrade has the same shape. A plugin or theme calls a function that the newer PHP removed, or passes a value in a way the newer PHP no longer tolerates. PHP stops with a fatal error, and WordPress shows either a blank screen or the "critical error" message. If that happens, our guide to the WordPress white screen of death walks through how to read the cause and get back in.

You'd rather find the problem before it finds you. A short checklist, in the order that pays off:

  1. List everything that's active. Plugins and the active theme, plus any child theme. Inactive plugins don't execute, so they can't break the switch, but delete the ones you'll never use anyway.
  2. Check the last update date for each. On a plugin's wordpress.org page, the "Last updated" line and the "Tested up to" version tell you whether anyone is still looking after it. A plugin untouched for years is the likeliest culprit.
  3. Read the changelog for PHP notes. Maintainers usually mention "PHP 8.x compatibility" when they fix it. No mention in a long changelog is not proof of anything, but a recent explicit mention is a good sign.
  4. Update everything first, on the PHP version you already have. Update WordPress core, plugins and theme while the site is still running normally. Then change PHP. Mixing both changes into one step makes the cause of any failure harder to pin down.

There are also scanners. The PHP Compatibility Checker plugin reads your code and flags constructs that newer PHP versions reject. Treat its report as a list of leads. A static scan can't see code paths that only run when a customer checks out with a particular shipping method, so it will miss some things and flag others that never actually execute.

Custom code deserves its own mention. If a developer once added snippets to the theme's functions.php or wrote a small bespoke plugin, nobody is publishing a changelog for it. Those are the pieces where "tested up to" doesn't exist, and they're worth a proper read-through or a staging test.

Turn on debug logging while you test

Before you switch, enable WordPress's debug log so errors land in a file instead of on the screen. The WordPress debugging documentation explains the WP_DEBUG and WP_DEBUG_LOG constants in wp-config.php. After the switch, deprecation notices in that log are your early warning: they're the things that work today and will stop working in a later version. Turn debug display off again when you're done, and never leave it showing errors to visitors.

Take a verified backup first

This is the step people skip because the switch looks reversible. The version change itself is reversible. Your data may not be, and the next section explains why. A backup is cheap insurance against the part you can't flip back.

"Verified" is doing real work in that heading. A backup file that exists is not the same as a backup that restores. Zero-byte archives, truncated database dumps and half-finished uploads all look like files in a folder. The question to ask of any backup before you rely on it: can I see that it completed, and could I restore from it today?

For the record, this is how our own service handles that, as described on the how it works page. BackupYourSite connects over SSH on a schedule, tars the files, dumps the database and streams both to its own staging area, so nothing is written to your server's disk. Each archive must pass integrity checks, and the database dump must end with MySQL's own "dump completed" marker, before a run is allowed to report success. Verified archives go to encrypted offsite storage. If a check fails, the run is marked failed and retried rather than stored quietly.

Whatever you use, the principle is the same. You want both halves: the files (themes, plugins, uploads, wp-config.php) and the database. A database-only copy leaves you rebuilding the site's code from scratch, and a files-only copy loses every post, order and setting. Our piece on how often to back up a WordPress site covers the cadence question. For a PHP change specifically, take one manual backup immediately before you switch, even if last night's run was clean. Anything written between last night and now, such as an order or a comment, isn't in last night's copy.

Check that it finished. Look at the backup's date and size in your dashboard, and if you can, confirm the files and the database both show up. Two minutes here is the entire difference between a nuisance and a disaster.

Switching PHP in cPanel, on a VPS and on managed hosts

Panels differ in name and layout, but the options fall into three families. Find yours below, and if your host's own documentation disagrees with a generic description, follow the host.

cPanel hosting

Most cPanel hosts expose a PHP selector. It's commonly found under Software → MultiPHP Manager or Select PHP Version, depending on the host's setup. You pick the domain, choose a version from the dropdown, and apply. The change usually takes effect immediately for that domain. Some hosts also let you toggle individual PHP extensions on the same screen, and a switch can quietly change the extension set. If a plugin needs imagick, intl or similar and the new version's profile doesn't enable it, you'll see errors that look unrelated to the version change at all. Check the extension list after you switch.

VPS or dedicated server

Here the host isn't managing PHP for you. Several versions can be installed side by side, and the web server is told which one to use for a given site. With PHP-FPM, that usually means pointing the site's configuration at the socket for the target version, then reloading the web server. The details depend on your distribution and stack, so use your distribution's or control panel's documentation rather than copying commands from a blog post, including this one. The thing worth carrying over from this section: install the new version beside the old one, switch the site, and leave the old version installed until you're confident. That makes the rollback a configuration edit rather than a reinstall.

Managed WordPress hosts

Managed hosts normally put the PHP version in their own dashboard, per site or per environment, often as a simple dropdown. Many also offer a staging environment where you can switch the version first and look at the result without touching the live site. If yours does, use it. Some managed hosts also limit which versions you can choose, and they'll retire old ones on their own timeline whether you're ready or not. It's worth knowing where yours sits on that schedule.

If you aren't sure where your host keeps the setting, their support documentation search for "change PHP version" nearly always finds it in one try. And if you can't find it at all, ask support. They get the question daily.

Test what matters: checkout, forms and logins

Loading the homepage and seeing it render is not a test. The homepage is the page most likely to be cached, which means it can look perfect while the dynamic parts are throwing errors underneath. Spend ten minutes on the things that only work when PHP actually executes your code:

  • Logging in and out as an administrator, and as an ordinary user if you run memberships.
  • Every form. Submit the contact form and confirm the email arrives. Mail-sending code is a common casualty.
  • Checkout, if you sell anything. Add a product, go through to the payment step, and use your gateway's test mode if it has one. Do not run a real card through production as a test without a plan for refunding it.
  • Search, filters and anything with AJAX. These run through admin-ajax.php and the REST API, and they fail without a visible page error.
  • The admin screens. Open the plugin settings pages you actually use, not just the dashboard home.
  • Scheduled tasks. Look at whether WP-Cron jobs still run, such as scheduled posts or your backup trigger.

Then read the debug log you enabled earlier. Fatal errors will already have announced themselves. What you're hunting for now are the quieter deprecation warnings, which tell you which plugin to replace before the next upgrade rather than during it.

If a fatal error does appear, don't start editing code. Roll back first (next section), get the site healthy, and then work out which plugin is responsible on a staging copy. Our comparison of staging versus backup explains why a staging site and a backup do different jobs, and you'll want both for this kind of work.

Rolling back: the PHP switch versus the data

The two things people lump together under "undo" are quite different.

The PHP version is reversible. It's a setting. Put the dropdown back to the old value, or point the web server back at the old PHP, and the code runs on the old interpreter again. No files changed. That's why this is a reasonable thing to attempt at all, and why we say to keep the old version available on a self-managed server.

Data written in between may not be reversible. Think about what happens in the window between your switch and your rollback. Visitors place orders. Customers register. Comments arrive. Editors save drafts. Plugins run their own database updates, because some update routines trigger on the first page load after anything changes. Moving PHP back doesn't remove those new database rows, and it doesn't undo a plugin's schema change either. If a plugin migrated its tables on the new PHP and the older code can't read the new layout, the PHP rollback alone won't bring you back to a working site.

That's the case where a backup earns its place, and it exposes a trade-off worth thinking about before you start. Restoring the pre-switch backup returns you to a known-good state, but it also discards everything that happened since the backup was taken. On a quiet brochure site that costs you nothing. On a store taking orders, it can mean orders that exist in your payment processor but not in your database. The way out is to keep the window short: switch at a quiet hour, test right away, and decide quickly. The longer the new version runs live, the more data accumulates that a restore would wipe.

So the realistic rollback ladder looks like this:

  1. Switch PHP back. Try this first. If the site recovers and nothing was written in the meantime, you're finished.
  2. Disable the suspect plugin. If you know which one broke, rename its folder over SFTP or SSH and the site loads without it.
  3. Restore the backup. Last resort, with a clear head about what you'll lose. Restoring files only, or the database only, is sometimes enough. Pick the smaller restore if you can.

It helps to know in advance that you can do the third step, and how. Per our own restore flow, you pick a site, see every backup actually held in storage, choose files, database or both, and confirm. Whatever tool you use, rehearse the restore path before you need it, not during an outage.

Make it routine instead of an emergency

The painful PHP upgrades are the ones left until the host forces them, because that deadline arrives with no testing time. A calmer approach is to treat PHP like any other dependency with a calendar. Look at the supported versions page once or twice a year. When your version drops into security-only mode, schedule the move for a quiet week. Update plugins, take the verified backup, switch on staging if you have it, and test. That's the whole routine, and it's dull in the best way.

If you maintain several sites, write the target version and the date you last checked into whatever tracker you already use. Then it's a ten-minute review rather than a surprise. And if your plugin list contains something abandoned that's blocking you from moving up, that's information too: it's a replacement job you've now scheduled while nothing is on fire.

The same backup that protects you here also covers the other ways a site goes wrong, from a bad update to a hack. If you want a quick picture of how ours behaves from the first connection to the first restore, the how it works page is the short version.

Frequently Asked Questions

How do I check which PHP version my WordPress site uses?

In the dashboard, go to Tools → Site Health → Info → Server. The PHP version appears there. Your host's control panel shows the same setting and is the place where you'd change it, so if the two disagree, trust the panel and look for an override in .htaccess.

Will updating PHP break my WordPress site?

It can, if a plugin, theme or custom snippet uses code the newer PHP removed. Updating everything first, checking each plugin's last update date and testing on staging or with debug logging on catches most of it before visitors see anything. A well-maintained site often moves up without incident.

Can I go back to the old PHP version?

Yes. The PHP version is a setting, so selecting the old version again restores the old behaviour. What it won't undo is data written while the new version was live, or a database change a plugin made in that window. That's why a backup taken just before the switch matters.

Which PHP version should WordPress use?

According to wordpress.org, hosts should support PHP 8.3 or greater. Per php.net's supported versions page, 8.3 gets security fixes until 31 December 2027, 8.4 until 31 December 2028 and 8.5 until 31 December 2029. Pick the newest one your plugins have been tested on.

Should I back up before updating PHP?

Yes, every time, and take a fresh one right before the switch rather than relying on last night's copy. Make sure it covers both files and the database, and confirm it completed. A backup you haven't checked is a hope, not a safety net.