Where WP_DEBUG sits in the request path
- The web server (Apache, LiteSpeed, or Nginx) accepts the connection and maps the URL to a file on disk. Apache and LiteSpeed also read every .htaccess file in the directories along that path.
- The server decides the file needs PHP and hands it to a PHP runtime. That runtime might be mod_php inside Apache, LSAPI on LiteSpeed, or a separate PHP-FPM process reached over a FastCGI socket.
- PHP compiles and runs index.php, which pulls in wp-blog-header.php, then wp-load.php, then wp-config.php.
- wp-config.php defines its constants and finally requires wp-settings.php. Early in wp-settings.php, WordPress calls a function named wp_debug_mode(). That function reads WP_DEBUG, WP_DEBUG_LOG, and WP_DEBUG_DISPLAY and changes PHP's error settings to match.
- Only after that do plugins, themes, and WordPress's own fatal error handler come into play.
When the web server fails before PHP runs: .htaccess
- php_value or php_flag lines on a server where PHP runs through FPM or CGI. Those directives belong to mod_php, so Apache does not recognize them.
- Directives from modules that are not loaded, such as Header lines without mod_headers.
- A typo in a block that a security or caching plugin wrote and then left behind.
When PHP-FPM never answers
- FPM is stopped, or the socket path in the web server config does not match the pool's listen setting. The connection fails outright.
- A worker is killed partway through a request, for example by a segmentation fault in a buggy extension or by the kernel's out-of-memory killer. The web server sees the connection close before a valid response arrives.
- The request runs past request_terminate_timeout and the master kills the worker on purpose.
When wp-config.php breaks before the switch exists
PHP
// Place these above the 'stop editing' comment, and remove any earlier WP_DEBUG define
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true ); // writes to wp-content/debug.log
define( 'WP_DEBUG_DISPLAY', false ); // keeps errors off the public page
/* That's all, stop editing! Happy publishing. */
require_once ABSPATH . 'wp-settings.php';Reading the logs in the right order
BASH
# Check wp-config.php for syntax errors without executing it
php -l /path/to/wordpress/wp-config.php
# Web server error log (pick the one that matches your stack)
tail -n 50 /var/log/apache2/error.log # Apache on Debian/Ubuntu
tail -n 50 /var/log/httpd/error_log # Apache on RHEL-family systems
tail -n 50 /var/log/nginx/error.log # Nginx
# Kernel messages, to spot PHP workers killed for memory
journalctl -k --since '1 hour ago' | grep -i -E 'oom|killed process'TEXT
Illustrative log format (paths, PIDs, and line numbers will differ)
/var/www/html/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration
WARNING: [pool www] child 12345 exited on signal 11 (SIGSEGV)
upstream prematurely closed connection while reading response header from upstream
PHP Parse error: syntax error, unexpected identifier in /var/www/html/wp-config.php on line 42