1. Home
  2. Blog
  3. “There Has Been a Critical Error” After a PHP Update: How to Fix It

“There Has Been a Critical Error” After a PHP Update: How to Fix It

PHP updates are the cornerstone of security and speed in the WordPress ecosystem, but misconfigurations can make your site completely inaccessible. To deliver a web experience that meets current standards, you need to manage the technical bottlenecks of upgrading to PHP 8.3 and later correctly.

By meomanWordPress since 2008

Typical Compatibility Issues When Moving to PHP 8.3+

PHP 8.3 and the upcoming 8.4 release offer much stricter type checking and error reporting than earlier versions. While WordPress core adapts to these changes quickly, third-party plugins and custom themes often keep using old functions. In situations such as using “null” values in arrays or handling undefined variables, PHP 8.x throws a “Fatal Error” and brings the site down.

As websites grow more complex, detecting these code errors manually becomes impossible. Developers must treat “deprecated” warnings not just as notices but as early warnings that the system will eventually stop working altogether. Incompatibilities in the codebase usually come from widely used string functions such as strpos() and preg_replace() receiving the wrong parameters.

As server architectures change, memory management also differs between PHP versions. A plugin that ran stably on an older version can trigger a “Memory Exhausted” error under the stricter memory checks of PHP 8.3. This shows up especially during image processing or large data imports and can paralyze the site’s background tasks (WP-Cron).

  • Type errors caused by passing null values to function parameters that require a strict type.
  • Class errors caused by the deprecation of dynamic properties.
  • The complete removal of the old mysql_ functions and the requirement to use PDO/MySQLi.
  • Incompatibilities in regex patterns and the security holes created by the /e modifier.
  • Strict rules on using strings instead of integers for array access.
PHP versionStatus in 2026Performance GainSecurity levelSupport Status
PHP 8.1End of life%10LowNo security patches
PHP 8.2Older version%18MediumCritical patches only
PHP 8.3Standard%25HighFull support
PHP 8.4Recommended%32Very highActive development
PHP 8.5+Upcoming version%40+HighestBeta/planned

Techniques for Fixing the “There Has Been a Critical Error” Message

When your WordPress site shows a white screen or the message “There has been a critical error on this website,” the first thing to do is turn on PHP error reporting. Setting WP_DEBUG to true in the wp-config.php file shows directly on screen which file and line the error is in. This is the fastest way to tell whether the problem comes from the theme or from a specific plugin.

Once you’ve found the source of the error, renaming the plugin’s folder via FTP or your file manager restores access to the site. Modern server panels (cPanel, Plesk, CyberPanel) now let you roll back the PHP version with one click, but that’s only a temporary fix. For a permanent fix, the failing function needs to be rewritten to PHP 8.x standards, or the plugin needs to be replaced with an up-to-date alternative.

Analyzing log files regularly is vital to keep the error from coming back. The wp-content/debug.log file records not only the current error but every warning running in the background that drags down performance. For a developer, this log file is the site’s health report, and it should be watched closely for the first 48 hours after a version upgrade.

  1. Viewing error details by adding the line define( 'WP_DEBUG', true ); to the wp-config.php file.
  2. Restoring access to the admin dashboard by disabling the failing plugin in the wp-content/plugins directory.
  3. Analyzing crashes at the PHP-FPM level by checking the server error logs (error_log).
  4. Keeping the site online by temporarily rolling the PHP version back to a lower one such as 7.4 or 8.1.
  5. Stopping the faulty component with one click via the WordPress Recovery Mode email.

Maximum Performance with PHP JIT (Just-In-Time)

Introduced in PHP 8.0 and matured in version 8.3, the JIT (Just-In-Time) compiler promises a dramatic performance boost for WordPress sites. JIT compiles part of the PHP code directly into machine code, so CPU-intensive tasks complete much faster. For high-traffic WordPress sites, configuring JIT has become a standard optimization step.

Although WordPress core is mostly I/O (input/output) bound, plugins that perform complex mathematical calculations and large WooCommerce stores benefit directly from JIT. For JIT to be effective, the opcache.jit_buffer_size value on the server must be set correctly. A wrong configuration can waste server resources, or even cause instability, instead of improving performance.

Performance strategies shouldn’t stop at PHP itself; PHP’s communication with the database must be optimized too. PHP 8.4 supports advanced object caching mechanisms to process database queries faster. A PHP stack integrated with Redis or Memcached brings page load times down to the millisecond range.

  • Optimizing the most frequently used code blocks by setting the opcache.jit parameter to tracing mode.
  • Setting the buffer size based on your site’s traffic load (usually between 64M and 128M).
  • Analyzing CPU load with the Query Monitor plugin to measure JIT performance.
  • Speeding up garbage collection cycles using PHP 8.3’s memory management.
  • Using Xdebug profiling tools to identify plugin-level performance bottlenecks.
Related serviceWordPress Site Updates

A 5-Step Testing Protocol for a Safe Upgrade

Updating the PHP version of a live website directly isn’t a professional approach. Because continuous operation (uptime) is critical to business success, a 5-step testing protocol should be followed. The first step is to take a full backup of the current site and bring that backup up on a separate subdomain (staging).

After upgrading the PHP version in the staging environment, test all of the site’s critical functions. Contact forms, payment systems, member logins and API integrations must work smoothly under PHP 8.x. If an error occurs, fix it in the staging environment and note down the code fix. This process reduces the risk of the live site going down because of an error to zero.

The fourth step is scanning plugins with tools such as PHP Compatibility Checker and updating incompatible ones. If a plugin hasn’t been updated in a long time and throws errors with PHP 8.3, continuing to use it creates a security hole. The final step is to run the upgrade on the live server once all tests pass, then monitor the site with real-time monitoring tools for the first hour.

  1. Backing up the current site’s files and database with “All-in-One WP Migration” or a similar tool.
  2. Creating a staging (test) site and simulating the move to PHP 8.3/8.4 there.
  3. Manually testing key user scenarios (purchasing, signing up, submitting forms).
  4. Clearing hidden warnings by reviewing the developer console and PHP logs.
  5. Completing the process by checking DNS and SSL certificate compatibility after going live.

Source: WordPress.org Plugin Directory

Server Resource Management and PHP-FPM Optimization

In modern WordPress hosting, PHP-FPM (FastCGI Process Manager) is the heart of performance. PHP-FPM manages the worker processes that execute PHP scripts. The pm.dynamic and pm.ondemand modes, which adapt to dynamic traffic loads, are preferred for using server resources efficiently. Setting a fixed number of workers can leave the site unresponsive during sudden traffic spikes.

PHP limits such as max_execution_time and memory_limit should be optimized to keep WordPress from crashing during heavy tasks (for example, backups or image optimization). Although memory usage is more efficient in PHP 8.3, a limit of at least 256 MB or 512 MB is recommended for complex themes. You can make these settings in the server’s php.ini file or in the PHP settings section of your hosting panel.

The opcache.revalidate_freq setting should also be reviewed to increase PHP’s processing capacity. Keeping this value low during development lets code changes show up immediately, while raising it on live sites (for example, to 60 seconds) significantly reduces CPU load. For 2026 performance, the split between static and dynamic content should be optimized at the PHP level.

  • Calculating the pm.max_children value based on server RAM (around 50 MB per process on average).
  • Automatically terminating hung PHP processes with the request_terminate_timeout setting.
  • Enabling the PHP-FPM “slow log” feature to detect requests that take longer than 1 second.
  • Expanding the code cache by setting opcache.memory_consumption to at least 128 MB.
  • Eliminating the communication overhead of TCP/IP by using Unix sockets.

Database Processing Speed and PHP Version Alignment

70% of WordPress performance depends on how quickly database queries are processed. PHP 8.3 works in excellent harmony with MySQL 8.0 and later. The mysqli and PDO drivers in newer PHP versions establish database connections more securely and quickly. Database optimization isn’t just about cleaning tables; it’s about shortening the “handshake” time between PHP and the database.

Database calls in older PHP versions usually lack asynchronous processing. Thanks to the improvements in PHP 8.x, WordPress core can serialize database results faster. This directly affects how quickly category pages load, especially in WooCommerce stores with thousands of products. Having database tables on the InnoDB engine lets PHP use row-level locking to speed up concurrent operations.

Using an object cache on the PHP side is a must to minimize database queries. 2026 strategies aim for PHP to pull previously processed data from RAM instead of going to the database on every page load. This reduces server load by up to 50% while improving perceived speed for users.

  • Keeping the WP-DB class up to date so it works with PHP 8.x’s modern mysqli functions.
  • Reducing the data PHP loads on every request by cleaning up autoload values in database tables.
  • Configuring the Redis Object Cache plugin at the PHP level to cache query results.
  • Increasing PHP’s text processing speed by setting the database character set to utf8mb4_unicode_520_ci.
  • Using PHP-based profiling tools to detect unnecessary database queries.

Ways to Modernize Legacy Code

By 2026, code left over from the PHP 5.6 or 7.2 era is the biggest security and performance threat to WordPress sites. Modernization doesn’t end with changing the PHP version; the code structure itself also needs to be brought up to PHP 8.4 standards. For example, using the short array syntax ([]) instead of old-style array definitions, or improving memory management with anonymous functions, is part of this process.

Automated tools such as “Rector” can be used for code modernization. These tools analyze old PHP code and automatically update it to the rules of the new version. Manually updating large plugins or custom-built themes can take months, while automation tools like these can shorten the process to days. Modernization ensures the site not only works today but is also ready for PHP versions in 2027 and beyond.

Finally, to close security holes in the codebase, use the new encryption and hashing functions that come with PHP 8.x. Instead of old md5 or sha1-based operations, switch to modern, secure methods such as password_hash(). As cyberattacks grow more sophisticated, security measures at the PHP level form the site’s first line of defense.

  • Converting removed functions that pose security risks, such as create_function(), into anonymous functions.
  • Simplifying class structures with PHP 8.x’s “Constructor Property Promotion” feature.
  • Optimizing all isset() and empty() checks in the codebase with PHP 8’s “Nullsafe Operator” (?->).
  • Scanning old plugin files with PHP_CodeSniffer and fixing non-standard code.
  • Updating third-party libraries (Composer packages) to the latest stable PHP versions.

Source: Core Web Vitals and Performance Guide

Frequently Asked Questions

Why does my site show a white screen after updating PHP?

This usually happens because a plugin or theme calls an old function that isn’t compatible with the new PHP version. Turn on debug mode in wp-config.php to find the failing file, then disable it.

Which PHP version is the most secure and fastest?

PHP 8.3 is currently the most stable and widely supported version, but PHP 8.4 is recommended for performance-focused projects. PHP 8.2 and older versions carry risk because they no longer receive security updates.

Will updating PHP delete my data?

A PHP version update only changes the code processing engine on the server; it doesn’t touch your database or files. Still, it’s always recommended to take a full backup in case system errors occur.

What should I do if an old plugin doesn’t work with PHP 8.3?

First, check for the plugin’s latest version; if there’s no update, look for “PHP Compatibility” patches. If the problem persists, switch to a modern plugin with similar functionality that is compatible with PHP 8.x.

Should I enable PHP JIT on every WordPress site?

On low-traffic, simple blog sites, JIT’s effect may not be noticeable, but enabling it is recommended for sites that use CPU-intensive plugins. Before enabling JIT, make sure your server resources are sufficient.

In short
WordPress PHP version upgrades require a rigorous testing protocol and error management to reach 2026 performance goals. By moving to PHP 8.3 and 8.4, you can maximize your site’s security while increasing page load speeds by up to 30%.