Fix the WordPress critical error on your website

I built a shiny new server recently. Then I spent three hours trying to migrate my site to it. So it goes. But even after the site mostly worked right, WordPress gave me a critical error on my website every time I tried to save a post. Here’s how I fixed the problem.

The message there has been a critical error on your website, please check your site admin email for instructions can be scary, especially when you check your e-mail and there’s nothing there. I found the WordPress dashboard can help.

Don’t disable the WordPress fatal error handler – fix it!

wordpress critical error on your website
Meet the new WordPress white screen of death. Same as the old white screen of death, just with a bit of text added to warn you about a critical or fatal error on your website.

Most of the advice on the WordPress critical error on your website says to disable the fatal error handler. Sounds good in theory. But that fatal error handler is designed to prevent the dreaded white screen of death. But why not try the easiest fix first, right? So I disabled the fatal error handler by adding the line define( ‘WP_DISABLE_FATAL_ERROR_HANDLER’, true ); in wp-config.php. Guess what happened? I got white screens of death every time I saved a post.

I fixed the problem by visiting my site’s dashboard, then scrolling down to Site Health Status. You know, that widget that tells you it’s time to migrate off PHP5. Or maybe that’s just me. (That shiny new server may have had something to do with PHP.) Click on the Site Health screen link to get the more detailed view. In my case, up at the top it warned me about some missing PHP modules. One missing module, called gd, is required. I was also missing a few nice-to-haves.

After I installed the PHP modules that were missing and restarted Apache with the command systemctl restart apache2, I went back to the Site Health screen and refreshed the page. I got a clean bill of health, aside from a warning that I should uninstall the themes I’m not using.

So then I went back to my editor and loaded up a post. I made a couple of minor changes, then saved them. No white screen of death. No fatal error handler.

I’m not saying this will fix the problem for you. In my case, I had an incomplete PHP configuration and that was what caused my problem. The dashboard only takes a minute to check, so that’s a good place to start on this problem too.

If you found this post informative or helpful, please share it!