Management Guides Troubleshooting
WordPress Critical Error and White Screen: Find and Fix It
"There has been a critical error on this website" hides a PHP fatal error. How to read the real message on a VPS and fix it by cause: plugin, theme, PHP upgrade, memory or core files.
"There has been a critical error on this website." is the page WordPress shows when PHP stopped with a fatal error. The white screen of death, a blank page, is the same event without the message. Neither tells you what went wrong; the real error, with a file name and a line number, is in a log.
The fix has two steps. Read the actual error from the PHP log or the WordPress debug log, then act on what it names: nearly always a plugin or theme, often right after an update or a PHP version change, sometimes exhausted memory or an incomplete core update.
The commands follow the official WordPress and WP-CLI documentation; they were not run on a test server for this article.
What you see and where to look
| What you see | Likely cause | Where to look |
|---|---|---|
| Critical error on every page after installing or updating something | Fatal error in a plugin or theme | The file path in the error message |
| Critical error after a PHP or distribution upgrade | Code incompatible with the new PHP, or a missing PHP extension | nginx or PHP-FPM error log |
| Log says "Allowed memory size ... exhausted" | PHP memory limit reached | memory_limit |
| Error after an update that was interrupted | Incomplete core files | wp core verify-checksums |
| "Briefly unavailable for scheduled maintenance" that does not go away | Leftover .maintenance file | Site root folder |
| Critical error only when editing one page | A block or page-builder plugin, or memory | Debug log while you repeat the action |
Get the real error message
The server logs. By default PHP-FPM passes PHP errors to nginx, which writes them to its error log.
# Ubuntu, Debian
sudo grep "PHP Fatal" /var/log/nginx/error.log | tail -n 5
# AlmaLinux, Rocky Linux: the packaged pool writes PHP errors to its own file
sudo tail -n 20 /var/log/php-fpm/www-error.log
A typical line reads PHP Fatal error: Uncaught Error: Call to undefined function ... in /var/www/example.com/wp-content/plugins/some-plugin/includes/file.php:123. The folder after plugins/ or themes/ is the culprit.
The WordPress debug log. If the server logs show nothing, turn on WordPress's own log. Add these lines to wp-config.php, above the line that says "That's all, stop editing":
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );
If the file already defines WP_DEBUG, change that line instead of adding a second one. WP_DEBUG_DISPLAY set to false keeps errors off the pages visitors see. Reload the failing page, then read the log:
sudo tail -n 30 /var/www/example.com/wp-content/debug.log
The recovery mode email. When a fatal error occurs, WordPress emails the site administrator a message that names the plugin or theme and contains a link for logging in with the broken component paused. On a VPS that was never set up to send mail it does not arrive, which is why the logs come first.
A plugin or theme
If the error names a plugin, deactivate it with WP-CLI. The two --skip flags tell WP-CLI not to load plugin and theme code, so the command works while the site is broken:
cd /var/www/example.com
# the web user is www-data on Ubuntu, Debian; nginx or apache on AlmaLinux, Rocky Linux
sudo -u www-data wp plugin deactivate PLUGIN-FOLDER --skip-plugins --skip-themes
If you do not know which plugin it is, deactivate all of them, then activate them one at a time until the error returns:
sudo -u www-data wp plugin deactivate --all --skip-plugins --skip-themes
curl -I https://example.com/
sudo -u www-data wp plugin activate PLUGIN-FOLDER
Without WP-CLI, rename the plugin's folder; WordPress deactivates a plugin it can no longer find:
sudo mv wp-content/plugins/PLUGIN-FOLDER wp-content/plugins/PLUGIN-FOLDER.off
Neither method touches files in wp-content/mu-plugins or drop-in files such as wp-content/object-cache.php. If the error path points there, move that file out of the way; for the cache drop-in, see Redis object cache.
If the error names the theme, switch to a default theme:
sudo -u www-data wp theme list --skip-plugins --skip-themes
sudo -u www-data wp theme activate twentytwentyfive --skip-plugins --skip-themes
Use any default theme the list shows. Update the faulty plugin or theme before activating it again.
After a PHP version upgrade
A new PHP version removes functions and tightens rules that older plugin code relied on. The log then shows "Call to undefined function" or an uncaught TypeError inside a plugin. The lasting fix is to update that plugin or replace it: sudo -u www-data wp plugin update PLUGIN-FOLDER --skip-plugins --skip-themes.
If the undefined function belongs to PHP itself, for example mysqli_connect(), an extension was not installed for the new version. Install it (sudo apt install php8.5-mysql on Ubuntu and Debian, sudo dnf install php-mysqlnd on AlmaLinux and Rocky Linux) and restart PHP-FPM.
On Ubuntu and Debian you can put the site back on the previous PHP version while you sort the plugin out, provided the old packages are still installed. Each version has its own service and socket:
ls /run/php/
systemctl is-active php8.3-fpm
If the old socket is listed and the service is active, point the site's fastcgi_pass back to it and reload nginx:
fastcgi_pass unix:/run/php/php8.3-fpm.sock;
sudo nginx -t && sudo systemctl reload nginx
curl -I https://example.com/
Tools → Site Health → Info → Server confirms which PHP version serves the site. Treat this as temporary: PHP 8.3 and 8.2 receive security fixes only, and 8.2 only until 31 December 2026. AlmaLinux and Rocky Linux install one PHP version at a time from their own repositories, so there the practical route is fixing or removing the plugin.
Memory exhausted
"Allowed memory size of 134217728 bytes exhausted" means one request needed more than PHP's memory_limit; that number is 128 MB. WordPress memory limit explains how to raise it in the right place and how much a small server can afford.
Incomplete core update
An update interrupted by a timeout or a full disk can leave core files missing or half written. Compare the installed files with the official checksums:
sudo -u www-data wp core verify-checksums
sudo -u www-data wp core version
If files fail the check, download the same version again over the existing files. --skip-content leaves out the bundled themes and plugins, so wp-content is not touched, and wp-config.php is not part of the download:
sudo -u www-data wp core download --version=7.1.5 --force --skip-content
sudo -u www-data wp core verify-checksums
Use the version number that wp core version printed, and add --locale= if the site was installed in a language other than English. If the command fails with permission errors, see WordPress file permissions. If the check lists files that should not exist and you did not put them there, read cleaning up a hacked WordPress site before going further.
Leftover .maintenance file
During an update WordPress creates a file named .maintenance in the site root and removes it at the end. If the update dies, the file stays and the site shows the maintenance notice, or an error if the file is damaged. Delete it:
ls -la /var/www/example.com/.maintenance
sudo rm /var/www/example.com/.maintenance
curl -I https://example.com/
Then run the update again, preferably from the shell with wp core update.
Critical error only when editing a page
When the site works and the error appears on opening or saving one page in the editor, the fatal error occurs in an editor request. Repeat the action with the debug log on and read its newest lines. The common findings:
- A block or page-builder plugin that fails on the content of that page; the path in the error names it.
- Memory exhausted, because a long page with many blocks needs more memory to load in the editor than to display.
Turn debugging off and protect the log
debug.log sits inside the web root and can be downloaded by anyone who guesses its address. When you are done, set WP_DEBUG and WP_DEBUG_LOG back to false and delete the file:
sudo rm /var/www/example.com/wp-content/debug.log
If you prefer to keep logging on, give WP_DEBUG_LOG a path outside the web root that the web user can write to, for example define( 'WP_DEBUG_LOG', '/var/log/wordpress/example.com.log' );, or block the default location in the site's nginx server block:
location = /wp-content/debug.log { deny all; }
sudo nginx -t && sudo systemctl reload nginx
curl -I https://example.com/wp-content/debug.log
The last command must return 403 or 404, not 200. WordPress security on nginx has the other rules worth adding at the same time.