How to Do a WordPress PHP Upgrade Without Breaking Your Site

Your host wants you on a newer PHP version, and you are worried something will break. The staging-first process I use to upgrade PHP safely.
Wordpress php upgrade: code editor displaying react source code

If your host has emailed you about an old PHP version, or Site Health keeps warning you, it’s time for a WordPress PHP upgrade. Done carelessly, it can take a site down in seconds. Done in the right order, it’s a calm afternoon of testing. I’ll explain why the upgrade matters, what tends to break, the exact staging-first process I follow on client sites, and how to pick the right version to move to.

Why a WordPress PHP upgrade matters

PHP is the language WordPress runs on. Your host installs a version of it, and that version has a lifespan. Each PHP release gets active development for a while, then security fixes only, then nothing at all. You can see the current support dates on the official supported versions page at php.net.

Running a version that no longer gets security fixes is a real risk. If a flaw is found in PHP itself, nobody will patch it. On top of that:

  • Newer PHP versions are generally faster, so pages build quicker on the same server.
  • Plugin and theme developers drop support for old versions, so you stop getting updates.
  • Hosts eventually force the upgrade. Doing it yourself means you choose the timing and test first.

To check your current version, go to Tools, then Site Health, then the Info tab, and open the “Server” section. If it starts with 7, you’re well overdue. The 8.0 and 8.1 lines are also past end of life.

What usually breaks when PHP changes

WordPress core handles new PHP versions well. The risk sits in plugins, themes and custom code, especially older ones.

  • Removed functions. Code that calls something PHP no longer has will stop with a fatal error.
  • Stricter rules. PHP 8 turned many old warnings into errors. Code that passed the wrong type of value used to limp along. Now it can crash.
  • Deprecation notices. These do not break the site but fill your logs, and they’re tomorrow’s errors.
  • Old page builders and themes. A theme bought years ago and never updated is the most common blocker I see.
  • Custom snippets. Code a previous developer pasted into functions.php is rarely tested on new versions.

The tricky part is that problems don’t always show up on the home page. An error can hide in a checkout step, a password reset email, or an admin export that only runs at month end. That’s why I test by risk: money, leads and data sent to other systems come first.

My step-by-step PHP upgrade process

This is the order I follow. It works for a brochure site and for a busy WooCommerce store.

  1. Back up everything. Files and database, stored somewhere other than the server.
  2. Take an inventory. List every plugin and the theme, with the date each was last updated. Anything untouched for a couple of years goes on a watch list.
  3. Update everything on the current PHP first. Newer plugin versions usually include compatibility fixes. Do not change two big things at once.
  4. Create a staging copy and switch only the staging site to the new PHP version. Most hosting panels let you set PHP per site.
  5. Turn on debug logging on staging with WP_DEBUG and WP_DEBUG_LOG.
  6. Click through the important paths: home page, main service pages, every form, search, cart, checkout with a test payment, the customer account area, and the admin screens you use, including the page builder editor.
  7. Read the log. Fatal errors must be fixed before going live. Deprecation notices go on a list for later.
  8. Fix or replace. Update the plugin, ask its developer, patch custom code, or swap the plugin for a maintained one.
  9. Switch the live site at a quiet hour. Keep the old PHP version available in the panel so you can switch back in seconds if something was missed.
  10. Watch the logs for a week. Some code only runs on a schedule, like monthly reports or renewal emails.

If you do not have staging

You can still do it, but more carefully. Pick the quietest hour, switch PHP, test the key paths immediately, and switch back the moment anything fails. Then fix the problem before trying again. This is where a proper staging setup pays for itself.

Which PHP version to move to

Choose a version that’s still under active support and that WordPress and your key plugins list as compatible. WordPress publishes its recommended PHP version on its requirements page. Your main plugins list a “Requires PHP” or tested version on their pages.

A few rules I follow:

  • Don’t jump to a brand-new PHP release in its first weeks. Give plugin developers time to catch up.
  • Skipping versions is fine, for example going straight from 7.4 to a current 8.x release, but test more thoroughly.
  • If one plugin blocks the upgrade, that plugin is the problem, not the upgrade. Plan to replace it.
  • Check that the PHP extensions your plugins rely on, such as image libraries, are enabled for the new version. Hosts usually include them, but custom servers may not.

On older sites, the upgrade is often the moment you find out that a theme is beyond saving. That’s not a disaster. It is a signal that a rebuild or a targeted fix will cost less than living with the risk.

Quick checklist

  • Check your current version in Site Health.
  • Back up files and database off the server.
  • List plugins and theme with last update dates.
  • Update everything on the current PHP first.
  • Switch staging to the new PHP and turn on debug logging.
  • Test forms, checkout, accounts and admin screens.
  • Fix fatal errors, then switch live at a quiet hour.
  • Monitor logs for a week and keep the rollback option ready.

If you’re working on this, these pair well with it: how to track down a WordPress plugin conflict after an update and how to update WordPress plugins safely.

FAQ

Will a newer PHP version make my site faster?

Usually a little, sometimes noticeably, because pages are built faster on the server. It won’t fix heavy images or bloated plugins, though.

Can I switch back if something breaks?

In most hosting panels, yes, in a few clicks. That’s why I keep the old version available until the site has run cleanly for a while.

My host says it will upgrade PHP automatically. Should I worry?

Get ahead of it. Test on staging before their deadline so the automatic switch is a non-event instead of a surprise outage.

What if a plugin I rely on does not support the new version?

Contact the developer first. If there’s no answer or no plan, find a maintained alternative. Holding a whole site back for one plugin is rarely worth it.

I test it on staging, fix what breaks, and switch live at a quiet hour. Get a free website review to start, or ask about ongoing WordPress maintenance.

Share this article

Shehzad Akram

About the author

Shehzad Akram

Senior WordPress and Shopify developer in Lahore, Pakistan, Top Rated on Upwork with 100% Job Success. I write these notes from real client work: what broke, what fixed it, and what I check every time.

Keep reading

More notes from real client work