PHP errors and the white screen

Troubleshooting 11 min read

Your site shows a blank white page, a "500 Internal Server Error", or the WordPress message "There has been a critical error on this website". All three usually mean the same thing: PHP stopped with an error, and WordPress hid the error from visitors. This page gets the real error out, explains what it means, and gets you back into the admin.

It applies to any WordPress site, whatever theme or plugins it runs.

#Words you will meet on this page

If you have never looked under the hood of a WordPress site, these are the terms the rest of the page uses:

PHP

The programming language WordPress, themes and plugins are written in. It runs on your web server and builds each page before it is sent to the browser.

Fatal error

An error bad enough that PHP stops building the page. What is left is the white screen.

Hosting control panel

The website where your host lets you manage the server, such as cPanel, Plesk or a custom dashboard. It usually has a File Manager that lets you browse and rename files in the browser.

FTP and SFTP

Ways to connect to your server's files from a program on your computer, such as FileZilla. SFTP is the encrypted version, use it when your host offers it. Your host gives you the login details.

wp-config.php

The main WordPress configuration file, in the site's root folder next to wp-content. It holds your database password, so never share its contents.

wp-content

The folder that holds your themes (wp-content/themes), plugins (wp-content/plugins) and uploads.

WP_DEBUG

A setting in wp-config.php that tells WordPress to record errors instead of hiding them.

debug.log

The file those errors are written to, at wp-content/debug.log.

PHP extension

An optional add-on to PHP, such as mbstring or curl, that the host installs. Code that needs a missing extension fails.

Stack trace

The list of lines under an error showing which files were running when it happened. It is the most useful part to send to a developer.

WP-CLI

A command line tool for managing WordPress over SSH, offered by many hosts. Optional, and everything below also works without it.

#Step 1: Get the real error text

"I get a white screen" cannot be diagnosed, because a white screen is the absence of a description. Before anything else, get the error message.

Check your email first

When PHP hits a fatal error, WordPress emails the site's admin address. The email names the plugin or theme that failed and contains a recovery mode link, which opens the admin with the failing code paused. That is often the fastest way back in.

Turn on error logging

Open wp-config.php through your hosting File Manager or SFTP. Just above the line that says /* That's all, stop editing! */, add:

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );

The third line keeps errors off the screen, so visitors do not see them. If any of these lines already exist, change their values instead of adding them twice.

Reproduce the problem

Load the page that breaks, or repeat the action that broke it.

Read the log

Open wp-content/debug.log. The last entries are the newest. Look for a line starting with PHP Fatal error: it contains the message, a file path and a line number.

Turn logging off again when you are done

Set WP_DEBUG back to false and delete debug.log. A log left on a live site grows forever and can reveal file paths to anyone who guesses its address.

WordPress documents these settings in Debugging in WordPress. If debug.log stays empty, your host's own PHP error log, usually under Logs or Errors in the control panel, catches errors that happen before WordPress loads.

#Step 2: Read the message

These are the messages you are most likely to see, and what each one means in plain words.

Allowed memory size of 134217728 bytes exhausted

The script ran out of memory. Common during a demo import, image processing or with heavy plugins. Raise the PHP memory_limit in your hosting panel, or ask your host. The minimum our themes need is on server requirements.

Maximum execution time of 30 seconds exceeded

The operation did not finish in the time PHP allows. Same situations as above. Raise max_execution_time in the hosting panel.

Call to undefined function

The code called a function this server does not have. Usually a missing PHP extension such as mbstring, gd, curl, zip or dom, or code written for a newer PHP or WordPress than you run.

Class "..." not found

Same family as the one above: a missing extension, a missing file from an incomplete upload, or a version mismatch.

Call to a member function ... on null

The code received nothing where it expected something. The message itself says little, and the file path in it says where it crashed.

Uncaught TypeError

The code received the wrong kind of value. Very common when an old plugin runs on a newer PHP version.

syntax error, unexpected ...

A PHP file was edited and the edit is broken, often through the built in file editor in the admin or a pasted snippet. Restore the original file.

Cannot redeclare ...

The same code is loaded twice: a duplicate plugin, an old copy of the theme in another folder, or a snippet pasted in two places.

cURL error 28 or cURL error 60

The server cannot reach another server. Error 28 is a timeout, 60 is an SSL certificate problem. It breaks license activation, updates and demo import together, and it is your host's to fix.

Error establishing a database connection

Not a PHP error, but it looks just as bad. WordPress cannot reach its database: wrong details in wp-config.php, or the database server is down. Contact your host.

Most PHP errors on a fresh site come down to two things: a PHP version below what the code needs, or a missing PHP extension. On a site running our theme, the Diagnostics screen checks both for you. The third common cause is a conflict with an old or abandoned plugin.

#Step 3: Get back into the admin

If the error locks you out of the admin and recovery mode did not help, you can switch the failing code off from outside WordPress. Everything here is done in the hosting File Manager or over SFTP, and all of it is reversible.

The error's file path names the folder, for example wp-content/plugins/some-plugin/....

  1. Open wp-content/plugins.
  2. Rename that plugin's folder, for example some-plugin to some-plugin-old.
  3. Reload the admin. WordPress cannot find the plugin, so it deactivates it and lets you in.
  4. Rename the folder back to its exact original name when you are ready, then activate the plugin again from Plugins. Renaming alone does not reactivate it.

When you cannot tell which plugin is at fault:

  1. Rename wp-content/plugins to plugins-old.
  2. Reload the admin. Every plugin is now deactivated.
  3. Rename the folder back to plugins. The plugins stay deactivated.
  4. Activate them one at a time from Plugins, reloading the site after each. The one that brings the error back is the culprit.

Plugins in wp-content/mu-plugins (must-use plugins) are not affected by this and have to be renamed separately.

When the path points into wp-content/themes/your-theme/:

  1. Make sure a default WordPress theme, such as Twenty Twenty-Five, is present in wp-content/themes. Without one, WordPress has nothing to fall back to.
  2. Rename your active theme's folder, for example your-theme to your-theme-old.
  3. Reload the admin. WordPress finds the active theme missing and switches to the default theme.
  4. When the problem is solved, rename the folder back to its exact original name and activate it again from AppearanceThemes.

Theme settings are stored under the folder name, so the exact original name brings them back. Widgets may need to be put back in their areas afterwards.

If your host gives you SSH access:

wp plugin deactivate some-plugin
wp plugin deactivate --all
wp theme activate twentytwentyfive

Take a backup before changing files, even to rename a folder.

Most hosts create one from the control panel in a click. See Securing a WordPress site for why a backup stored somewhere else matters.

#Step 4: Work out whose code it is

The error always contains a file path, and the path shows where the crash happened.

A path under wp-content/plugins/some-plugin/ points at that plugin. A path under the theme folder or our Pro plugin points at our code.

Where it crashed is not always who caused it. Another plugin can change data our theme relies on, load an old copy of a shared library, or break a hook, and the crash then lands inside our files even though our code did nothing wrong. The same happens in reverse. Telling the two apart takes a developer reading the whole stack trace.

The reliable method is slow and simple: deactivate every third party plugin, check whether the error is gone, then enable them one at a time. If the error disappears with plugins off, it is a conflict, and responsibility for third party code sits with that code, as described in Third party plugins and where responsibility sits.

If it stays with only our theme and Pro plugin active, that is exactly the report we want.

How to diagnose a problem and report a bugIf something on your site looks broken and you want it fixed quickly, this page walks you from the first checks to a bug report we can act on. Most things that look broken turn out to be unf...Troubleshooting

#If it is our theme or plugin

Open a support request with:

  • The full error from debug.log: the message, the path and the stack trace, copied as text rather than a cropped screenshot

  • The theme and Pro plugin versions, and your PHP and WordPress versions

  • Whether the error stays with every other plugin deactivated

  • What you did right before it appeared

See Getting help with your theme for where each detail goes in the form.

#Common questions

Can I edit the theme or plugin code to fix the error myself?

To get a broken site running again, yes, temporarily. Keep a copy of the original file and note exactly what you changed. Two things to know: the next update replaces the file and your edit disappears, and an installation with edited product files is outside support under the Support Policy. If you believe the bug is in our code, send us the error so it gets fixed properly in a release, and restore the original file before we look at it.

Can I paste the error into an AI assistant to fix it?

An assistant is good at explaining what an error message means, and that is a sensible first step. Treat any code it writes the same way as your own edit: a temporary repair, not a fix, and never on a live site without a backup. Never paste wp-config.php, passwords or API keys into it. If the error is in our theme or Pro plugin, send us the original error text, not the AI's diagnosis, because an assistant has never seen your site and tends to guess the cause.

The error mentions your theme. Does that mean the bug is yours?

Not necessarily. The path shows where the code crashed, and something else may have caused it, such as another plugin changing data or loading an incompatible library. Run the plugin check above first. If the error survives with only our products active, report it with the full log.

The white screen appeared right after an update

Check whether the update needs a newer PHP version than your server has, since that is the most common cause. On our themes you can also roll back to the previous version, see Updating the theme and rolling back a version.

The log is empty

Either logging was turned on after the error, the wp-content folder is not writable, or the failure happens before WordPress loads. Your host's PHP error log catches all three.

I cannot reach the admin to turn debugging on

You do not need the admin. WP_DEBUG and WP_DEBUG_LOG live in wp-config.php, which you edit through the File Manager or SFTP.

The site works for me and shows a white screen to visitors

That is usually a page cache or a CDN serving a broken copy to everybody who is not logged in. Clear the page cache and the CDN before looking for a PHP error that may no longer exist.

Only one page is white, the rest of the site works

Something on that page fails: a block, a shortcode or a widget. The log still has the error, so reproduce it by loading that page with logging on.

Renamed the theme folder and the site is still blank

WordPress had no default theme to fall back to. Upload a default theme such as Twenty Twenty-Five from wordpress.org into wp-content/themes, then reload.

#Still stuck

Open a support ticket and say what you tried and where it stopped. Your product, your domain, a screenshot and the exact message you saw are usually enough to settle it in one reply.

Last updated

Was this article helpful?

Related articles

FIND THE ONE THAT FITS YOUR PROJECT

Import a demo, swap the content, adjust the layout. Modern WordPress under the hood, fast even when the site fills up.