PHP 7.4 has reached its end of life. An upgrade is mandatory, and many hosts only offer the old PHP version together with paid extended support packages. But the jump to 8.2+ regularly takes WordPress sites down. This article shows the concrete causes, the exact error messages from the error log, and proven solutions for each problem.
Do not feel like doing everything yourself? I help my clients with PHP version upgrades and with technical problems of all kinds:
Why is the jump from PHP 7.4 to 8.2+ so problematic?
Upgrading from PHP 7.4 to 8.2 or 8.3 is not an ordinary version update. It is a jump across four major releases (8.0, 8.1, 8.2, 8.3), each of which brings its own breaking changes. Every one of these versions removed functions, changed behaviors, or introduced new rules that are not compatible with older code.
The problem: All of these changes hit at once when you jump straight from 7.4 to 8.2+. Code that ran stably for years under PHP 7.4, in some cases with functions from the PHP 5 era, breaks down without warning.
What technically changed in PHP 8.x
To understand the error messages, it helps to have a short overview of the relevant changes per PHP version:
PHP 8.0
Stricter typing: null is no longer accepted in string functions. Removal of old functions such as create_function(), each(), get_magic_quotes_gpc(). Changed comparison behavior for ==.
Risk: High
PHP 8.1
Deprecation notices for null passed to internal functions. Changed default behavior of htmlspecialchars(). Implicit float-to-int warnings.
Risk: Medium
PHP 8.2
Dynamic object properties produce deprecation notices. utf8_encode()/utf8_decode() removed. Return type requirements for built-in interfaces.
Risk: High
PHP 8.3
Further deprecations, typed class constants. Few breaking changes for WordPress.
Risk: Low
The biggest risk lies in PHP 8.0 (removed functions, strict typing) and PHP 8.2 (dynamic properties). PHP 8.3 itself is rarely the trigger for outages.
The 7 most common errors after the PHP upgrade
Fatal Error: TypeError - null passed to string functions
This is the most common reason for a WordPress outage after a PHP upgrade. PHP 8.0 tightened the typing of internal functions such as strlen(), strpos(), trim(), or strtolower(). These functions no longer accept null as an argument. In PHP 7.4, null was silently treated as an empty string. In PHP 8.x, it causes a fatal error that crashes the entire site.
Fatal error: Uncaught TypeError: strlen(): Argument #1 ($string) must be of type string, null given
in /wp-content/plugins/example-plugin/includes/class-handler.php on line 142
Fatal error: Uncaught TypeError: trim(): Argument #1 ($string) must be of type string, null given
in /wp-content/themes/starter/functions.php on line 87
Fatal error: Uncaught TypeError: strtolower(): Argument #1 ($string) must be of type string, null given
in /wp-content/plugins/flavor-seo/classes/meta.php on line 203
Why this happens so often: Many WordPress plugins read values from the database with get_option() or get_post_meta(). If the entry does not exist, null or false is returned. In PHP 7.4 that was not a problem. In PHP 8.x it is a total outage.
// Before - works under 7.4, fatal error under 8.x
$title = get_post_meta( $post_id, '_custom_title', true );
echo strtolower( $title );
// After - safe under all PHP versions
$title = get_post_meta( $post_id, '_custom_title', true );
echo strtolower( $title ?? '' );
Fatal Error: Call to Undefined Function
PHP 8.0 permanently removed functions that were merely marked as deprecated under 7.4. If a plugin or theme still uses one of these functions, the result is a fatal error.
Fatal error: Uncaught Error: Call to undefined function get_magic_quotes_gpc()
in /wp-content/plugins/flavor-forms/includes/submission.php on line 31
Fatal error: Uncaught Error: Call to undefined function create_function()
in /wp-content/themes/starter-theme/functions.php on line 54
Fatal error: Uncaught Error: Call to undefined function each()
in /wp-content/plugins/flavor-slider/includes/init.php on line 118
// Old code (fatal error under PHP 8.x)
add_action( 'widgets_init', create_function( '', 'register_widget("My_Widget");' ) );
// Correct code
add_action( 'widgets_init', function() {
register_widget( 'My_Widget' );
});
Flood of Deprecations: Dynamic Properties
Since PHP 8.2, dynamic object properties trigger a deprecation notice. This does not cause a crash directly, but it can produce hundreds of entries in the error log and becomes a fatal error in PHP 9.0.
Deprecated: Creation of dynamic property CustomPlugin\Admin::$settings is deprecated
in /wp-content/plugins/custom-plugin/admin/class-admin.php on line 45
// Before - deprecation notice under PHP 8.2+
class MeinPlugin {
public function __construct() {
$this->version = '1.0'; // Never declared
$this->settings = []; // Never declared
}
}
// After - properly declared
class MeinPlugin {
public string $version;
public array $settings;
public function __construct() {
$this->version = '1.0';
$this->settings = [];
}
}
Return Type Incompatibilities
PHP 8.x requires return types for classes that implement built-in interfaces such as Countable, Iterator, or ArrayAccess. Older plugins without return types produce masses of deprecation notices.
Deprecated: Return type of CustomCollection::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used
in /wp-content/plugins/flavor-toolkit/includes/collection.php on line 56
// Temporary fix - suppresses the notice
#[\ReturnTypeWillChange]
public function count() {
return count( $this->items );
}
// Permanent fix - add the return type
public function count(): int {
return count( $this->items );
}
Silent Logic Errors: Changed Comparison Behavior
This error is particularly tricky because it produces no error message. PHP 8.0 fundamentally changed the behavior of the == operator when comparing strings and numbers.
Deprecated: Return type of CustomCollection::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used
in /wp-content/plugins/flavor-toolkit/includes/collection.php on line 56
// PHP 7.4
0 == "foobar" // true → string is converted to 0
0 == "" // true
// PHP 8.x
0 == "foobar" // false → not a numeric string, no comparison
0 == "" // false
$role = get_user_meta( $user_id, 'custom_role', true );
switch ( $role ) {
case 'admin':
// PHP 7.4: If $role = 0 → matches 'admin' (0 == "admin" was true!)
// PHP 8.x: No longer matches → user loses access
grant_admin_access();
break;
}
// Fix: Use the strict comparison === or cast the variable beforehand
htmlspecialchars() Problems
As of PHP 8.1, htmlspecialchars() no longer accepts null, and the default flag has changed. This affects many themes that call this function directly.
Deprecated: htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated
in /wp-content/themes/starter-theme/header.php on line 19
Visible impact: Invalid UTF-8 sequences are replaced by the Unicode replacement character (�) instead of being treated as an empty string. This can lead to visible display errors on the website, even when no fatal error occurs.
Serialization Errors in the Database
PHP 8.x is stricter when processing serialized data. WordPress stores many settings in serialized form in the wp_options table, including widget configurations, plugin settings, and transients.
Warning: unserialize(): Error at offset 168 of 1894 bytes
in /wp-includes/option.php on line 89
If this data has become corrupt through faulty migrations or search-and-replace operations (for example, a domain change), errors occur under PHP 8.x that were still tolerated under 7.4.
White Screen After the PHP Upgrade - First Aid in 5 Minutes
The WordPress White Screen of Death (WSOD) after a PHP upgrade is almost always a fatal error in a plugin or theme. Here is how to find the cause:
Check the error log
Connect via FTP or SSH and check /wp-content/debug.log. If debug mode is not active, add the following to the wp-config.php:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
Switch PHP back
If the site urgently needs to be back online: reset the PHP version in the hosting panel (cPanel, Plesk, etc.) to 7.4. This is a workaround, not a solution, because PHP 7.4 no longer receives security updates.
Disable plugins via FTP
Rename the folder /wp-content/plugins/ to plugins_disabled via FTP. If the site works afterwards, a plugin is to blame. Rename the folder back and deactivate plugins one by one. You can also do this easily via FTP: simply change the folder name of the plugin by adding an underscore, and WordPress automatically deactivates the affected plugin.
Switch the theme
If plugins are not the problem: rename the active theme folder under /wp-content/themes/. WordPress falls back to a default theme (Twenty Twenty-Four).
How to Upgrade PHP Without Downtime
Phase 1 - Preparation
-
Create a full backup
Database (SQL export) and the entire
wp-contentfolder. Back up both separately and test the restoration beforehand. -
Set up a staging environment
Create a complete copy of the live website. Never test directly on the live site.
-
Update the WordPress core
At least version 6.4 is recommended for PHP 8.2+. Older WordPress versions have incompatibilities themselves.
-
Update all plugins and themes
Bring everything up to date before the PHP switch.
-
Run a compatibility check
Using a WordPress plugin or via the command line with PHPCompatibility:
# install PHPCompatibility composer global require phpcompatibility/phpcompatibility-wp # check plugins phpcs --standard=PHPCompatibilityWP \ --runtime-set testVersion 8.2 \ wp-content/plugins/
Phase 2 - The Switch
-
Enable debug mode on the staging environment
PHP - wp-config.php
define( 'WP_DEBUG', true ); define( 'WP_DEBUG_LOG', true ); define( 'WP_DEBUG_DISPLAY', false ); -
Raise PHP step by step
If possible: first 8.0, then 8.1, then 8.2. Check the error log at each step, so errors can be attributed to the respective version.
-
Evaluate logs systematically
After each PHP version, search the file
/wp-content/debug.logfor these keywords:Fatal error(site is down),Deprecated(still works, but will break in the future),Warning(potential problem), andNotice(low risk).
Phase 3 - After the Switch
-
Test critical functions
Checkout (WooCommerce), contact forms, login/registration, admin area, REST API, cron jobs.
-
Document performance
PHP 8.x brings measurable performance improvements thanks to the JIT compiler. A before-and-after comparison with Query Monitor or GTmetrix documents the gain.
-
Disable debug mode on the live site
Actively monitor the error log during the first few days after the switch.
FAQ: Frequently Asked Questions About the PHP Upgrade
Can I upgrade directly from PHP 7.4 to 8.2 or 8.3?
Technically yes, but the direct jump carries the highest risk. The recommended path is stepwise via 8.0 → 8.1 → 8.2 on a staging environment. This makes it easier to isolate errors and attribute them to the respective PHP version.
My host upgraded PHP automatically - what now?
If the site is already down: reset the PHP version in the hosting panel to 7.4 or 8.0, create a backup, and then test the upgrade on a staging environment. Many hosts (e.g., All-Inkl, Ionos, Raidboxes) offer PHP version selection directly in the customer area.
WordPress shows a white screen after the update - is the site broken?
In most cases not permanently. The White Screen of Death is caused by a fatal error in a plugin or theme. Via FTP you can isolate the problem by renaming the plugins folder and reactivating plugins one by one.
Is it enough to update all plugins?
Usually a plugin update alone is enough, provided the developer has added PHP 8.x compatibility. For plugins without active maintenance, meaning no update since 2023, switching to an alternative is often a better solution than a manual patch.
Which WordPress version do I need for PHP 8.2+?
WordPress 6.4 or higher is recommended. Older versions have compatibility problems with PHP 8.x themselves. Before the PHP upgrade, you should always update the WordPress core first.
Does the PHP upgrade also bring benefits?
Considerable ones. Thanks to the JIT compiler, PHP 8.x brings noticeable performance improvements. On top of that come active security updates, more modern language features, and better error handling. The investment pays off in the long run.
How do I know whether my plugins are PHP 8.2 compatible?
The easiest way is the changelog on wordpress.org. If it says nothing about PHP 8.x and the last update was before 2023, that is a warning sign. The CLI tool phpcs with the PHPCompatibilityWP standard can automatically scan plugin code for known problems.
Conclusion
A WordPress outage after the PHP upgrade from 7.4 to 8.2+ is neither coincidence nor bad luck. It is the expected result when legacy code meets a modern PHP version. The good news: The problems are well documented, the error messages are unambiguous, and in most cases the solutions are manageable.
The golden rule: Use a staging environment, enable the debug log, test step by step, and do not let any plugin without confirmed PHP 8.2+ compatibility run on the live site.
Do not feel like doing everything yourself? I support clients with PHP version upgrades and with technical problems of all kinds:




