All ArticlesHosting2026-11-27T11:14:07+08:00

White Screen but WP_DEBUG Shows Nothing? Check Where debug.log Is Writing

You turned on WP_DEBUG to diagnose a white screen, but no error appears and debug.log stays empty or missing. After reading, you will be able to confirm that the WP_DEBUG_LOG and WP_DEBUG_DISPLAY constants are actually being loaded, check the log path and its file permissions, and fall back to the PHP-FPM error log to find the fatal error.

You get a white screen, so you open wp-config.php, set WP_DEBUG to true, enable WP_DEBUG_LOG, and reload the page. The page stays blank, and wp-content/debug.log is either empty or was never created. Debug mode seems to be on, yet nothing records the error. In most cases PHP is still writing the error somewhere. It just isn't writing to the file WordPress asked for.

This piece is written as a post-mortem of that pattern. It does not describe one specific incident. It follows the usual sequence: what the failure looks like, how the investigation tends to go, the point where the cause becomes clear, how to get the error on screen today, and what to change so the next white screen takes minutes to diagnose.

What the failure looked like

A white screen, sometimes called the white screen of death, is what PHP sends back when a fatal error stops the script before any HTML is produced and display_errors is off. Newer WordPress versions often catch the fatal and show the 'critical error' message instead. If the failure happens early, or the handler itself breaks, you still get a blank page or a bare HTTP 500.

The immediate impact is simple: the frontend, wp-admin, or both stop working, and nobody can see why. Customers often say the debug setting is broken. It isn't. The constants are a request to PHP, and several layers below WordPress can override that request.

How the investigation usually goes

The first step is to confirm that the constants you edited are the ones PHP actually loads. The standard snippet looks like this, and where you place it matters:

// Place above the line: /* That's all, stop editing! */
// and above: require_once ABSPATH . 'wp-settings.php';
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );

Check these failure points in order:

  1. Duplicate definitions. Many wp-config.php files already contain define( 'WP_DEBUG', false ); near the top. If you add a second define further down, the first one wins. PHP only issues a warning about the duplicate, and that warning goes to the log you can't find.
  2. Defined too late. WordPress reads these constants in wp_debug_mode(), which runs inside wp-settings.php. A define placed after the require_once line arrives after the decision has been made.
  3. Wrong file. WordPress can load wp-config.php from the directory above the install. Some deployments also keep a staging copy next to production. Check that the document root and the file you edited belong to the same site.
  4. Cached config. If OPcache runs with opcache.validate_timestamps=0, PHP keeps serving the compiled old version of wp-config.php until OPcache is reset or PHP-FPM is reloaded.

Next, check the log location and its permissions. With WP_DEBUG_LOG set to true, the target is wp-content/debug.log. The PHP process must be able to create that file, so the user PHP runs as needs write access to wp-content. That user depends on the stack. On per-account setups (PHP-FPM pools per user, suEXEC, LSAPI) it is usually the account user. On a plain single-site VPS it is often www-data or nginx. A file owned by root, or a directory without write permission for the PHP user, means PHP silently fails to open the log.

# Read-only checks, run from the WordPress root
grep -n 'WP_DEBUG' wp-config.php
ls -ld wp-content
ls -l wp-content/debug.log

# Debian/Ubuntu PHP-FPM layout; paths differ on RHEL, cPanel, and LiteSpeed
grep -Rn 'error_log\|log_errors\|disable_functions' /etc/php/*/fpm/

If the constants are correct and wp-content is writable, most investigations stall at this point. The next step is where the cause usually shows up.

Where the log was really going

WordPress does not write the log file itself. In wp_debug_mode() it calls ini_set() to turn on log_errors and to point error_log at debug.log. PHP then does the writing. Several things can make that ini_set() call fail without any visible error:

  • php_admin_value in the FPM pool. A PHP-FPM pool (the group of PHP worker processes serving a site) can set php_admin_value[error_log] and php_admin_flag[log_errors]. Values set with the admin variants cannot be changed by ini_set() at runtime. WordPress asks, PHP refuses, and errors keep going to the pool's log.
  • ini_set in disable_functions. Some hardened setups disable it entirely.
  • open_basedir restrictions. These limit which paths PHP can open. A custom log path outside the allowed list fails.
  • The error happens before WordPress loads. A syntax error in wp-config.php itself stops PHP before any constant takes effect. That error can only appear in the server-level log.

To see which of these applies, test from inside PHP-FPM itself. WP-CLI and php -i on the command line use the CLI configuration, which often differs from the pool serving the site. A small standalone file, which does not load WordPress and so cannot hit the same fatal, tells you what the web PHP really sees:

<?php
// Temporary diagnostic. Use a random filename and delete it right after.
header( 'Content-Type: text/plain' );
echo 'SAPI: ' . php_sapi_name() . PHP_EOL;
echo 'log_errors: ' . var_export( ini_get( 'log_errors' ), true ) . PHP_EOL;
echo 'error_log: ' . var_export( ini_get( 'error_log' ), true ) . PHP_EOL;
echo 'open_basedir: ' . var_export( ini_get( 'open_basedir' ), true ) . PHP_EOL;
echo 'disable_functions: ' . ini_get( 'disable_functions' ) . PHP_EOL;
$r = @ini_set( 'error_log', __DIR__ . '/wp-content/debug.log' );
echo 'ini_set error_log result: ' . var_export( $r, true ) . PHP_EOL;

Security warning: this file exposes server paths and PHP settings to anyone who requests it. Give it a random name, request it once, and delete it immediately. Do not leave it in the web root.

How to read the output: if ini_set returns false, something above WordPress has locked error_log, and the error_log line shows where errors are actually going. If error_log is empty, PHP is sending errors to its default destination. Under FPM that is typically the FPM log or the web server's error log, depending on settings such as catch_workers_output.

Getting the error in front of you today

The fastest way to get the error today is to read the log PHP actually writes to and search for the fatal line:

  • Open the path from the error_log result above, or the php_admin_value[error_log] value in the site's pool file.
  • If that is empty, check the PHP-FPM service log and the web server error log for the vhost. Search for PHP Fatal error or Uncaught, and make sure the timestamp matches your page reload.
  • On cPanel and similar panels, the per-domain error log or an error_log file in the site directory is often the place to look. The exact location depends on the panel and handler, so check its documentation or the vhost config.

The fatal line normally names a file and line number, which usually points to a plugin or theme. If it points to a plugin and you can't reach the dashboard, you can disable it from the shell as described in checking the plugin behind a white screen with WP-CLI. If the white screen started right after a PHP version change, the cause is often an old plugin calling a removed function, which is covered in white screen after moving to PHP 8.x.

As a last resort on a site that isn't public, you can briefly set WP_DEBUG_DISPLAY to true so the error prints in the browser. This only works if display_errors isn't also locked at pool level. It also shows paths to visitors, so switch it back off as soon as you have the message.

Making log location predictable

The lasting fix is to decide where errors go and make WordPress and PHP agree, instead of hoping ini_set() succeeds.

Give each site a PHP error log that the pool controls and the site user can write to, and keep it outside the web root. If the pool uses php_admin_value[error_log], treat that file as the real log and write its path in your runbook. If you want WordPress to manage its own file, set WP_DEBUG_LOG to a full path outside wp-content (supported in newer WordPress versions), make sure open_basedir allows that path, and don't lock error_log in the pool for that site. Either approach works. Mixing them is what produces the empty debug.log.

A few habits help. The default wp-content/debug.log is reachable over HTTP unless the web server blocks it, so don't leave logging pointed there on a live site. Put the log under logrotate or the panel's rotation. Turn WP_DEBUG back off after the incident.

For support staff the rule of thumb is short. When debug.log is empty, don't keep editing wp-config.php. Ask PHP-FPM where it is logging, check whether ini_set is allowed to change that, and read that file. The fatal error is almost always already there.