Disclosure: I build FatalGuard, a free WordPress plugin that reads these logs. You do not need it for this guide.

A WordPress site breaks. The screen is white, or a page shows a vague message. The real reason is almost always in a log file. This guide shows you how to turn the log on, find it, and read it.

Two logs, not one

You will hear "debug log" and "PHP error log". They are not the same file.

  • debug.log is written by WordPress. It exists only when you turn on logging in wp-config.php.
  • The PHP error log is written by PHP or your web server. Its place is set by the error_log setting in PHP, and your host decides the default.

Both hold PHP warnings, notices and fatal errors. Start with debug.log, because you control it.

Step 1: turn on debug logging

Open wp-config.php in your site root. Find the line that says That's all, stop editing!. Add these lines above it:

define( 'WP_DEBUG', true ); define( 'WP_DEBUG_LOG', true ); define( 'WP_DEBUG_DISPLAY', false ); @ini_set( 'display_errors', 0 ); 

What each one does:

  • WP_DEBUG turns on WordPress debug mode.
  • WP_DEBUG_LOG writes errors to a file.
  • WP_DEBUG_DISPLAY set to false hides errors from visitors. The ini_set line covers hosts where PHP has display_errors on. WordPress shows the same pair in its debugging guide. Keep both on a live site. Raw errors on screen can show file paths to everyone.

If WP_DEBUG is already defined, change the existing line. Do not define it twice.

WordPress documents these constants on the Debugging in WordPress page.

Step 2: find debug.log

By default the file is here:

wp-content/debug.log 

Open it over FTP or SFTP, or in your host's file manager. If it is not there yet, no error has happened since you turned logging on. Load the broken page once, then look again.

You can also set your own path:

define( 'WP_DEBUG_LOG', '/path/outside/webroot/wp-errors.log' ); 

WP_DEBUG_LOG accepts a file path as well as true. A path outside the web root is safer. A file in wp-content can be fetched by a browser on some servers if you do not block it.

Step 3: find the PHP error log

Your host may keep a separate log. Common places:

  • A file called error_log in the folder of the script that failed, often public_html or wp-admin.
  • A "Logs" or "Errors" page in cPanel, Plesk or your host's own panel.
  • Your host's dashboard, under logs or "PHP error log".

To see where PHP writes, add a small file info.php with <?php phpinfo(); in the site root, open it, and search for error_log. Delete the file right after. It exposes server details.

Step 4: read an error

Logs can be long. Read from the bottom. New lines are added at the end.

A typical fatal error looks like this:

[19-Nov-2026 09:14:02 UTC] PHP Fatal error: Uncaught Error: Call to undefined function acme_get_price() in /var/www/html/wp-content/plugins/acme-shop/includes/cart.php:88 Stack trace: #0 /var/www/html/wp-content/plugins/acme-shop/acme-shop.php(41): acme_render_cart() #1 /var/www/html/wp-includes/class-wp-hook.php(324): acme_shop_init() #2 /var/www/html/wp-includes/plugin.php(517): WP_Hook->apply_filters() 

Read it in this order:

  1. The level. Fatal error stops the page. Warning and Notice do not.
  2. The message. Here: a function does not exist.
  3. The file and line. cart.php:88 is where PHP gave up.
  4. The path. wp-content/plugins/acme-shop/ tells you which plugin. A path under wp-content/themes/ points to a theme. A path under wp-includes/ is core, but the cause is usually a plugin or theme that called it wrongly.
  5. The stack trace. #0 is the call closest to the error. Higher numbers are the callers. Look for the first line in a plugin or theme folder.

Common errors and what they usually mean

Call to undefined function. A plugin needs a function that is missing. Often another plugin is off, or a PHP extension is missing.

Allowed memory size exhausted. A script used more memory than the limit. Raise it with define( 'WP_MEMORY_LIMIT', '256M' ); in wp-config.php if your host allows it. If not, raise it in the host panel. Also ask why it needs that much.

Cannot redeclare function. Two plugins, or two copies of one plugin, define the same function.

Uncaught TypeError. Code passed the wrong kind of value. This often appears after a PHP version upgrade, when an old plugin does not match the new PHP.

Parse error / syntax error. A typo in a PHP file. Usually from a hand edit or a broken upload.

Warning: Undefined variable or array key. Not fatal. It is noise from sloppy code. Fix it when you have time.

A few tips

  • Turn it off when done. Set WP_DEBUG back to false on a live site. A log can grow large.
  • Do not share the log in public. It can hold paths, URLs and sometimes data. Remove secrets before you paste it into a forum.
  • Search the message. Copy the part after "Fatal error:", without the paths, and search for it.
  • Test the plugin. If the path names a plugin, deactivate it and see if the error stops.
  • Check PHP version. The Site Health screen under Tools shows your PHP version.

Where FatalGuard helps

If you would rather not edit files and open logs over FTP, the free plugin FatalGuard can help. It shows your debug.log and PHP error log in a viewer in the admin bar, with search and a live tail. Repeated errors are grouped with a count. It can also write the WP_DEBUG constants to wp-config.php for you through one switch, and restore your old values when you switch it off. If your host does not let it edit the file, it shows the exact lines to paste.

It also catches the fatal error behind the "critical error" screen and can send it to Telegram. That is free. The plugin is not a replacement for knowing how to read a log. It saves you the trip to the server.

Note one thing. FatalGuard keeps its logs in its own protected folder, not in the standard wp-content/debug.log place. Its Status tab shows the real path.

Summary

  1. Add the four lines from Step 1 to wp-config.php.
  2. Reload the broken page.
  3. Open wp-content/debug.log, or your host's PHP error log.
  4. Read from the bottom: level, message, file, line.
  5. The folder in the path names the plugin or theme at fault.
  6. Turn debug mode off when done.

Got an error you cannot read? Paste the message below, without paths or secrets, and others may help you read it.