Debugging & Profiling

See What a PHP Upgrade Will Break Before Your Host Does It for You

Test a PHP upgrade on staging: supported versions, debug log, money paths, forced cron, deprecations 8.1 to 8.5, a PHPCompatibilityWP scan and rollback.

Varun DubeyVarun Dubey
·15 min read
Chart of PHP 8.1 to 8.5 security support end dates under the heading What will a PHP upgrade break?

The reliable way to see what a PHP upgrade will break is to run it on a staging copy of your site: switch the PHP version there, log errors to a file instead of the screen, click through the pages that earn money, force the scheduled tasks and imports to run by hand, then read the log for several days. Fix or replace whatever the log names. A scanner called PHPCompatibilityWP adds coverage for code nobody visits, but it only reads files, so it supports the staging test and never replaces it. We checked every version date, command and link in this guide on 15 November 2026.

This is the hands-on job inside a bigger plan. Our end-of-year upgrade calendar covers dates and the order of work; this post covers one step of it, finding the plugin or theme file that will start throwing errors before your host flips the switch.

Which PHP versions are supported right now?

As of 15 November 2026, PHP 8.2 gets security fixes only until 31 December 2026, PHP 8.3 until 31 December 2027, PHP 8.4 until 31 December 2028 and PHP 8.5 until 31 December 2029. PHP 8.1 reached end of life on 31 December 2025 (last release 8.1.34), and PHP 8.0 and 7.4 ended years before. If your site is on 8.1 or older, nobody is fixing new flaws in that branch.

PHP branch

Active support until

Security fixes until

8.1

Ended

Ended 31 Dec 2025 (EOL)

8.2

31 Dec 2024

31 Dec 2026

8.3

31 Dec 2025

31 Dec 2027

8.4

31 Dec 2026

31 Dec 2028

8.5

31 Dec 2027

31 Dec 2029

Source: the php.net supported versions page and the php.net end-of-life page, read on 15 November 2026.

What does WordPress recommend?

The WordPress requirements page recommends PHP 8.3 or greater, MariaDB 10.11 or greater or MySQL 8.4 or greater, and HTTPS. It adds that WordPress also works with PHP 7.4 and MySQL 5.5.5, and warns those versions may expose your site to security vulnerabilities. The PHP compatibility page in the core handbook (updated 4 November 2026) lists WordPress 7.0 and 7.1 as supporting PHP 7.4 through 8.5, and WordPress 6.9 as supporting 7.2 through 8.5. WordPress 6.8 and 6.7 stop at 8.4, and 6.6 stops at 8.3.

Read that carefully: it describes WordPress core. It says nothing about your theme or the thirty plugins you installed, and that gap is what this whole guide is about. If a host warns you about a deadline, our post on checking your PHP version after a PHP-level security flaw covers the version question from the security side.

Which PHP version does the site really run?

Do not assume the web server and the command line use the same PHP. A site can serve pages on one version while the terminal (which WP-CLI uses, and which a real server cron job often uses) runs another. A mismatch hides problems, so check both.

The web side: Site Health

Go to Tools, then Site Health. The Info tab, under Server, shows the PHP version the web server uses. The WordPress.org Update PHP guide sends you to the same place and says 8.3 or higher is current.

The command line side: WP-CLI

Checked on 15 November 2026 with WP-CLI 2.12.0 on a local machine:

wp cli info
wp eval 'echo PHP_VERSION . " " . php_sapi_name() . "\n";'
php -v

On our test machine, wp cli info printed the PHP binary path, PHP version 8.5.5 and the php.ini in use, and php_sapi_name() printed cli. That cli is the clue: the command shows the command line PHP, never the web one.

One thing we noticed while running it: on PHP 8.5.5, WP-CLI 2.12.0 printed a deprecation notice on every start (“Case statements followed by a semicolon (;) are deprecated”) that came from a library bundled inside WP-CLI itself. The tool still worked. It is a handy reminder that even well-maintained software ships bundled libraries that lag a version or two behind PHP.

List what you will be testing

The WP-CLI plugin list command accepts --status and --format, and offers optional fields including requires_php and tested_up_to:

wp plugin list --status=active --fields=name,version,requires_php,update --format=table
wp theme list --fields=name,status,version,update --format=table

Update whatever has an update waiting before you test anything. It is the cheapest fix there is. requires_php is the author’s declared minimum, not a test result for a newer version.

How do you set up the staging test?

The goal is a copy of the site that behaves like production, runs the newer PHP, and cannot reach a customer. The WordPress.org guide says the same thing in one line: if your host offers a staging site, update PHP there first.

  1. Copy the site. Use your host’s staging tool, or copy files and database to a separate environment. Put payment gateways in test mode and trap outgoing mail so nothing emails a customer or charges a card.
  2. Switch PHP on staging. Pick the version you want to land on. If you are on 8.2 today, test 8.3 or 8.4 first, and 8.5 as a second pass. Run the version checks again to confirm both web and command line report the new version.
  3. Turn on the debug log without showing errors to visitors. The WordPress debugging documentation gives this block for wp-config.php:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );

The same page says WP_DEBUG_LOG saves errors to a debug.log file, that WP_DEBUG_DISPLAY controls whether messages show inside the page HTML, that WP_DEBUG_LOG can also be set to a file path, and that debug tools are not recommended on live sites and are meant for local testing and staging. Block public web access to the log on staging as well. Our guide to a debug.log that stays empty helps if nothing appears after you set this up.

  1. Start with an empty log. Move the old debug.log aside so every line you read comes from this test.
  2. Clear every cache. Page cache, object cache, opcode cache, CDN and the browser. A cached page never runs PHP, so a cached page proves nothing. Restart PHP-FPM, or ask the host to, so compiled code from the old version is gone.

Then watch the log while you test:

tail -f wp-content/debug.log

Which pages should you click through?

Click what makes or loses money first, then what staff need. Do each logged out and logged in, on a desktop window and a phone-sized one, and glance at the log after each step.

  • Home page. Slider, menus, widgets, footer, cookie banner.
  • One of each content type. Include a post with a gallery, an embed or custom fields.
  • Search. One search with results and one with none.
  • Login. Log in, log out, and use the lost password form.
  • Account area. Orders, downloads, profile edit, membership pages.
  • Cart and checkout with a test payment. Add an item, apply a coupon, change shipping, pay with the gateway’s test card, open the confirmation page. This is the single most valuable test on the list.
  • Every form type once, including one with a file upload.
  • Admin screens. Open the main menu items of each active plugin. Settings pages are code too.
  • The editor. Create a post with the blocks your team really uses, save, preview, publish and update.
  • Media upload. A JPEG, a PNG and a PDF, then check the thumbnails exist.

Write the steps down so the same pass can be repeated after each fix.

What can the log not see by itself?

PHP logs a problem only when the problem code runs. Browsing runs front end and admin code. A lot of important code does not run while you browse, so force it.

Scheduled tasks

On a quiet staging site, scheduled tasks may never fire during your test. The WP-CLI documentation describes wp cron event run --due-now as running all hooks due right now while respecting the doing_cron transient so runs do not overlap.

wp cron event list --fields=hook,next_run_relative
wp cron event run --due-now
# one plugin's task by hook name:
wp cron event run your_plugin_daily_hook

Run these on staging only; they can send email and call outside services. We cover detecting silent cron failures in monitoring WP-Cron and Action Scheduler failures, which is worth setting up on production after the upgrade.

Imports and exports

Imports and feed syncs parse text and arrays, where newer PHP is stricter. Run each with a five-row sample plus one deliberately messy row. PHP 8.4 also deprecates the default escape argument of fputcsv(), fgetcsv() and str_getcsv().

Payment and webhook callbacks

A webhook is a message the payment provider sends your site after a payment, refund or renewal. Browsing never triggers one. Most providers’ test tools can re-send an event to your staging address. Send one for a paid order, a refund and a failed payment, confirm the order status changed, and read the log. Register a test-mode endpoint for staging, never the live one.

Emails and rare shortcodes

Trigger each email that matters (new order, password reset, form notification) into a mail trap, because a template can fail while the page you clicked looks perfect. Open pages that use rare shortcodes, and view the site as a member, a customer and an editor, not only as an administrator. Leave staging on the new PHP for several days: weekly jobs will not appear in a one-day test.

How do you read the log?

The log is a text file with one entry per line: a timestamp, a level, a message, a file path and a line number. Our guide to reading WordPress error logs covers every level; this is the short version for an upgrade test.

Level

What it means

For the upgrade

Fatal error

PHP stopped the request. Visitors see a blank page or the “critical error” message.

Blocks the upgrade. Fix or replace before production moves.

Warning

Something is wrong but the page kept running, often a missing value or a wrong type.

On a money path or breaking output, treat as blocking. Otherwise schedule it.

Deprecated

The code uses something PHP plans to remove. It still works today.

Usually can wait, but it is the early warning for the next version. Record it and tell the vendor.

Notice

A minor problem, such as using a value that is not set.

Low priority unless there are thousands.

Example lines (made up, to show the shape)

These lines are illustrations and the plugin and theme names are invented.

[15-Nov-2026 10:14:02 UTC] PHP Fatal error:  Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /var/www/html/wp-content/plugins/acme-shop-extras/includes/cart.php:88

[15-Nov-2026 10:14:40 UTC] PHP Deprecated:  Acme_Widget::render(): Implicitly marking parameter $args as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/wp-content/plugins/acme-widgets/includes/class-widget.php on line 42

[15-Nov-2026 10:15:11 UTC] PHP Warning:  Undefined array key "price" in /var/www/html/wp-content/themes/oldtheme/functions.php on line 118

[15-Nov-2026 10:16:30 UTC] PHP Deprecated:  Creation of dynamic property Acme_Settings::$cache is deprecated in /var/www/html/wp-content/plugins/acme-settings/class-settings.php on line 27

To find who owns a line, read the path, not the message: the folder after plugins/ or themes/ names the culprit. A path under wp-includes/ is WordPress core, but the stack trace usually shows which plugin called it, so look for the first plugin or theme path. Line 1 is a fatal on a money path and blocks. Line 2 is the 8.4 implicit-nullable change and can wait. Line 3 may be a real bug or an old harmless one. Line 4 is the 8.2 dynamic property deprecation, usually fixed by declaring the property.

What changes in each PHP version from 8.1 to 8.5?

The php.net migration guides list every deprecation and removal. We read the deprecation pages for 8.1, 8.2, 8.3, 8.4 and 8.5 on 15 November 2026. This table keeps only the entries most likely to show up in an older plugin or theme, with the guide’s own wording where we quote.

Version

Change (from the migration guide)

What you see

8.1

Passing null to a non-nullable parameter of a built-in function is deprecated (the guide’s example is str_contains("foobar", null)). strftime() and gmstrftime() are deprecated.

Deprecated lines naming the function. Very common in older themes.

8.2

“The creation of dynamic properties is deprecated, unless the class opts in by using the #[\AllowDynamicProperties] attribute.” Also "${var}" string interpolation, utf8_encode() and utf8_decode().

Deprecated lines such as “Creation of dynamic property”. Widespread in plugins that never declared their properties.

8.3

“Calling get_class() and get_parent_class() without arguments is now deprecated.” Incrementing or decrementing non-numeric strings is deprecated.

Deprecated lines naming the function or operator.

8.4

“A parameter’s type is implicitly widened to accept null if the default value for it is null” is now deprecated. Also the E_STRICT constant, trigger_error() with E_USER_ERROR, and the default escape argument of the CSV functions.

The most common deprecation line today, usually from libraries bundled inside plugins.

8.5

The non-canonical casts (boolean), (integer), (double) and (binary), the backtick operator, using null as an array offset, and curl_close(), imagedestroy() and similar calls are deprecated.

Deprecated lines. A null offset can point to a value that is missing.

Sources: the php.net deprecation pages for 8.1, 8.2, 8.3, 8.4 and 8.5. The 8.4 and 8.5 guides also list MySQLi and PDO changes (for example the mysqli_ping() function in 8.4 and driver constants moving to namespaced classes in 8.5), so read them if a plugin talks to the database directly instead of through WordPress.

Is PHPCompatibilityWP worth running, and how?

Yes, as a second opinion. A static scan reads code without running it and flags functions, syntax and features your target version dislikes. PHPCompatibility is a set of rules for PHP_CodeSniffer (phpcs), and PHPCompatibilityWP is the WordPress flavour that skips back-fills WordPress already provides. It reaches code your clicking never does, including files nobody visits.

It cannot see a value that is null at runtime, a type problem that depends on live data, or behaviour that only shows with real input. It can also flag code that never runs. Treat the output as a map of suspicious files, not a pass or fail.

The install command in the README did not work for us

The PHPCompatibilityWP README gives this install, and says Composer is the only supported installation method:

composer config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
composer require --dev phpcompatibility/phpcompatibility-wp:"^3.0@dev"

On 15 November 2026, in a fresh Composer project with default settings, that second command failed. The 3.0 line (versions 3.0.0-alpha1 and 3.0.0-alpha2 on Packagist) needs phpcompatibility/php-compatibility ^10.0@dev, which “does not match your minimum-stability”. Two things work, and the difference matters.

Option 1, the stable release. Version 2.1.8 is the latest stable on Packagist and installed cleanly:

composer config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
composer require --dev phpcompatibility/phpcompatibility-wp:"^2.1"
vendor/bin/phpcs -i
vendor/bin/phpcs -p wp-content/plugins/my-plugin --standard=PHPCompatibilityWP --extensions=php --runtime-set testVersion 8.4-

It pulled in PHPCompatibility 9.3.5 and PHP_CodeSniffer 3.13.6. The phpcs -i line should list PHPCompatibilityWP; ours did.

Option 2, the 3.0 alpha. Allow dev stability in the project first:

composer config minimum-stability dev
composer config prefer-stable true
composer config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
composer require --dev phpcompatibility/phpcompatibility-wp:"^3.0@dev"

That installed 3.0.0-alpha2. It is a pre-release, so use it for scanning only and never ship it in a project’s production dependencies.

What each version caught on the same test file

We wrote a tiny test file with four known problems and scanned it with testVersion 8.4- (and 8.5- for the alpha). The file used create_function(), utf8_encode(), a parameter like Foo $a = null, a (integer) cast, and a bare get_class() call.

Problem in the test file

2.1.8 (PHPCompatibility 9.3.5)

3.0.0-alpha2

create_function() (removed in 8.0)

Warning only: “deprecated since PHP 7.2”

Error: “removed since PHP 8.0”

utf8_encode() (deprecated in 8.2)

Not reported

Warning: deprecated since 8.2

Implicitly nullable parameter (8.4)

Not reported

Warning: “Implicitly marking a parameter as nullable is deprecated since PHP 8.4”

(integer) cast (8.5)

Not reported

Warning: deprecated since 8.5

get_class() with no argument (8.3)

Not reported

Warning, plus an error for use outside a class

The stable scanner knew about the removal in PHP 8.0 but was silent about the 8.2 to 8.5 deprecations older plugins hit most, so a clean result from it means little for a jump to 8.4 or 8.5. This was one small file on one machine, not a benchmark, so run both against your own code before judging.

The testVersion value can be one version (8.4), a range (8.1-8.4) or open-ended (8.4-). Add --report=summary to see a count per file when a folder is large. Run scans on a working copy of the plugin or theme, never on the live server, and scan only code you own or can patch: findings inside a third-party plugin are a message for its vendor.

Common mistakes people report

These are recurring problems from vendor forums and support threads, paraphrased, with the page we read. All checked on 15 November 2026.

  1. Treating a harmless deprecation as a broken site, or ignoring a real fatal because the log is noisy. In a Kadence Security (Solid Security) forum thread, a user listed five deprecation notices on PHP 8.5, four of them implicitly nullable parameters. The vendor replied that they should not affect functionality but can be noisy, that the team knows about the gaps, and that PHP 8.3 is the workaround until a fix ships. The mistake is stopping at “it still works”: a notice-filled log hides the one fatal line that matters.
  2. Rolling PHP back to an unsupported version instead of reading the log. In a Gravity Forms community thread from January 2026, a user saw a critical error after moving to PHP 8.3 and went back to PHP 7.4 to get the site working. The vendor replied that the plugin supports 8.3 and asked for a support ticket. No cause appears in the thread. A rollback is a fine emergency move, but PHP 7.4 reached end of life in November 2022, so it should last hours, not months, and the log line would have named the real culprit.
  3. Silencing deprecations instead of fixing or reporting them. Independent Analytics has a knowledge base page explaining it cannot yet fix the PHP 8.4 notices from a bundled library without dropping PHP 7 support, and suggests filtering deprecation reporting. That is a reasonable vendor trade-off, but if you do it everywhere you lose the early warning for the next version. We keep them visible on staging and hide them on production.
  4. Not updating plugins before the switch. A All in One SEO thread (last modified 6 January 2025) reports a fatal error (“Call to a member function getAccessToken() on null”) after a client moved to PHP 8.3. The fix was a plugin update, version 4.7.7.2. Updating first would have avoided the broken page.
  5. Ignoring the 8.2 dynamic property warnings until a later PHP breaks something. Threads like the EU VAT for WooCommerce report (last modified January 2023) show plugin authors fixing these one release at a time, with new notices on other classes appearing in the next version. Expect several rounds, and test each update.

What are the common fixes?

Work down this list in order; the first is the cheapest.

  1. Update the plugin or theme. Many findings vanish after an update. Read the changelog for words like “PHP 8.3” or “PHP 8.4”, update on staging, repeat the click-through and check the log is quiet.
  2. Ask the vendor. If the newest version still logs the error, send the exact log line, the PHP version, the plugin version and the steps. A line with a file and line number is a report vendors can act on.
  3. Replace an abandoned plugin. No updates for a long time, an unanswered support forum and fatal errors on the new version means plan a replacement. Test it on staging and migrate data carefully.
  4. Patch small theme functions in a child theme, so a theme update does not overwrite your fix. Never edit plugin files directly: the next update erases the change. For a plugin, use a filter or hook if the vendor provides one.
  5. Remove it if nobody uses the feature any more.

If you own the code, two of the most common fixes are one-liners. We ran php -l on both snippets on PHP 8.5.5 on 15 November 2026.

// PHP 8.4: make the nullable type explicit.
// Before: function render( Widget $widget = null ) {}
function render( ?Widget $widget = null ) {}

// PHP 8.2: declare the property instead of creating it on the fly.
class Acme_Settings {
	public array $cache = array();
}

For dynamic properties you cannot declare (for example on a class that must accept arbitrary keys), the migration guide’s other route is the #[\AllowDynamicProperties] attribute, but declaring the property is the preferred fix and the one a new developer will understand in six months.

Staying on the old version for a while is fine if it is deliberate: a business-critical plugin fatals on the new version and the vendor has promised a fix in writing. The limit is the support date, which for PHP 8.2 is 31 December 2026. Ask your host in one short message to confirm in writing that they will not move the account before your ready date, and ask whether a middle version such as 8.3 works if that is what your test shows. Our guide to updating WordPress safely covers the backup and update order around this.

How do you roll back if production breaks?

Plan the rollback before the switch, not after. The WordPress.org Update PHP guide says to make a backup first, and says that if problems occur you can revert the PHP version yourself or ask your host to restore the previous version, then restore the backup if you need to.

  1. Back up files and database immediately before the switch, and confirm you can restore the backup somewhere.
  2. Know where the PHP selector is in your host panel and who to call if it is not self-service. Write down the old version number.
  3. Switch the PHP version back first. Our reasoning, not a documented rule: changing PHP does not change your database, so reverting the version is usually enough and keeps the orders and comments that arrived in the meantime. A full backup restore throws those away, so keep it for real data damage.
  4. Clear caches and restart PHP-FPM after the revert, then click the money paths again.
  5. Keep the debug log on staging, not production, and after the switch read your server’s own error log for a week.

One-page checklist

  1. Ask the host which PHP the account runs, their plan and their dates.
  2. Check web PHP and command line PHP. Update everything with an update waiting.
  3. Copy to staging with payments in test mode and mail trapped.
  4. Switch PHP on staging and re-check both versions.
  5. Set WP_DEBUG and WP_DEBUG_LOG to true and WP_DEBUG_DISPLAY to false. Empty debug.log. Clear all caches.
  6. Click the money paths, logged out and logged in, desktop and phone.
  7. Force the hidden code: cron, imports, webhooks, emails, admin screens, rare shortcodes.
  8. Read the log daily for several days and sort into fatal (blocks), warning (judge) and deprecated (can wait).
  9. Run PHPCompatibilityWP on code you own, using the 3.0 alpha if you test 8.2 or newer.
  10. Fix, repeat the pass, and stop when no new fatals or money path warnings appear.
  11. Back up, switch production, watch the logs for a week, keep the rollback ready.
  12. Turn debug off on staging and delete the log.

Questions people ask

Can we just let the host upgrade PHP and fix whatever breaks?

You can, but the breakage then lands on live pages in front of customers, usually on the least tested paths such as checkout callbacks and scheduled tasks. A staging test costs a few hours and moves the same discovery somewhere nobody is hurt.

Which PHP version should we move to?

WordPress.org recommends 8.3 or greater. Today that means 8.3, 8.4 or 8.5, all supported by WordPress 7.0 and 7.1 according to the core handbook. If your plugins are old, 8.3 is often the calmer first step, because 8.4 added the implicit-nullable deprecation that fills logs, and 8.5 added more. Test the version you plan to stay on for the next year.

Is a clean PHPCompatibility scan enough?

No. It reads code and does not run it, and as our test showed, the stable release misses most 8.2 to 8.5 deprecations. A clean scan plus a quiet debug log after the full click-through and forced tasks is a much stronger signal.

The log is full of deprecation notices but the site works. Should the upgrade wait?

Not necessarily. Deprecations warn about the future. Block on fatal errors and on warnings that change what a customer sees, and record deprecations for the vendors.

My plugin vendor says it supports the new PHP. Do we still need our own test?

Yes. Your site combines their code with your theme, other plugins and your data, and only your test covers that mix. The Gravity Forms thread above is a reminder that “supported” and “works on your site today” are different statements.

Need a hand with this?

If you would rather have someone run the staging pass, read the log and handle the plugin fixes, that is part of what we do for sites on our maintenance plans. See WordPress maintenance services for what is included. The method above works without us, and this guide is general technical information rather than a guarantee for any one site: test your own setup before you change production.

Part of the Wbcom Designs family

The all-in-one WordPress community stack

Also ours: wbcomdesigns.comvapvarun.combrndle.com