WordPress Logs: Debug, PHP, and Server Log Locations
In this article
To find and read WordPress logs, you need to check three separate places: the WordPress debug log (wp-content/debug.log), your PHP error log (often in the web server's directory or a cPanel logs folder), and the server access/error logs (typically in /var/log/ on Linux or the hosting control panel). The exact location depends on your hosting environment and whether you've enabled WordPress's built-in debugging.
Background: Why Logs Matter
WordPress is a PHP application that runs on a web server (Apache, Nginx, LiteSpeed, etc.). When something goes wrong—a white screen of death, a 500 error, a plugin conflict—the underlying cause is almost always recorded in one of these logs. Debug logs in WordPress capture PHP notices, warnings, and fatal errors that occur during execution. PHP error logs record issues at the server level, including syntax errors and memory exhaustion. Server access logs track every request (who visited, what they requested, the status code returned), while server error logs capture server-level problems like failed file permissions or crashed processes.
Understanding which log to check first saves time. For a plugin or theme issue, the WordPress debug log is usually the fastest. For a server misconfiguration or a PHP version problem, the server error log is more informative.
How WordPress Debug Logging Works
By default, WordPress suppresses the display of PHP errors and does not write a debug.log file. You must explicitly enable debugging by editing the wp-config.php file. Add or modify these constants:
- Open
wp-config.phpin a text editor (via FTP or the hosting file manager). - Find the line
define( 'WP_DEBUG', false );and change it todefine( 'WP_DEBUG', true ); - Add the following two lines just above the
/* That's all, stop editing! */comment:
define( 'WP_DEBUG_LOG', true ); define( 'WP_DEBUG_DISPLAY', false );
The first line tells WordPress to write errors to a file named debug.log inside the wp-content directory. The second line prevents errors from being shown on the page (which is safer for production). Once enabled, errors will be appended to wp-content/debug.log. You can view this file via FTP, the hosting file manager, or a text editor. Remember to remove these lines or set WP_DEBUG back to false after debugging, because leaving it on exposes sensitive paths and slows down the site.
Where to Find the PHP Error Log
The PHP error log is separate from WordPress's own log. It records errors that occur before WordPress even loads, such as parse errors in a plugin file. The location varies by hosting setup:
- Shared hosting (cPanel): Look in the
logsfolder inside your home directory. Often namederror_logorphp_error.log. In cPanel, you can also use the “Errors” section under “Metrics” to view recent errors. - Managed WordPress hosting (WP Engine, Kinsta, etc.): These hosts usually provide a log viewer in their control panel. Look for “Logs” or “Error Logs” in the dashboard.
- VPS or dedicated server: The PHP error log is typically at
/var/log/php_errors.logor/var/log/php-fpm.log, depending on how PHP is configured. You may need SSH access to read it.
If you don't know where your PHP log is, you can create a temporary PHP file with phpinfo(); and look for the error_log directive. But a simpler method is to check your hosting control panel first—most hosts expose the log path there.
Server Access and Error Logs
Server logs are maintained by the web server itself. They record every HTTP request (access log) and any server-level errors (error log). These are useful for diagnosing 500 errors, slow responses, or suspicious activity.
- Apache: On Linux, access logs are often at
/var/log/apache2/access.log(orhttpd/access_logon CentOS). Error logs are at/var/log/apache2/error.log. - Nginx: Access logs at
/var/log/nginx/access.log, error logs at/var/log/nginx/error.log. - LiteSpeed: Similar paths, often under
/usr/local/lsws/logs/.
On shared hosting, you typically access these via cPanel's “Raw Access Logs” or “Errors” section. Some hosts compress older logs into .gz files—you can download and unzip them to read.
How to Read the Logs Effectively
Logs can be huge, so don't open the whole file in a browser. Instead, use these methods:
- Filter by date: If you know when the error occurred, search for that timestamp. In a terminal, use
grep '2025-04-01' error.log. - Search for keywords: Common terms are
PHP Fatal error,Warning,Notice,500,memory exhausted. - Check the last lines: The most recent entries are at the end of the file. Use
tail -n 100 error.login the terminal. - Look for the plugin/theme name: Error messages often include the file path, like
/home/user/public_html/wp-content/plugins/example-plugin/example.php.
When you find an error, note the exact message and the file path. That tells you which plugin or theme to investigate. For example, a “Fatal error: Call to undefined function” points to a missing function, often due to a plugin conflict.
Common Problems and Misconceptions
One common misconception is that enabling WP_DEBUG will slow down your site. In reality, the performance impact is negligible for most sites; the real risk is exposing error messages to visitors if WP_DEBUG_DISPLAY is left true. Another issue is that the debug.log file can grow very large over time, so you should empty it after fixing the problem.
Another frequent problem: you enable WP_DEBUG_LOG but no debug.log file appears. This usually happens because the wp-content directory is not writable by the server. Check file permissions—the directory should be writable by the web server user (often 755 or 775). Also, some caching plugins or security plugins may block log creation; temporarily disable them.
If you see a 500 error but the WordPress debug log is empty, the issue is likely at the PHP or server level. Check the PHP error log first. A common cause is a plugin or theme with a syntax error that prevents the entire site from loading—the PHP log will show a “Parse error” with the file and line number.
Alternatives to Manual Log Reading
If you're not comfortable with raw logs, several tools can help:
- Debug plugins: Plugins like “WP Debugging” or “Query Monitor” can display errors in the WordPress admin dashboard, but they require the site to be partially functional.
- Hosting dashboard: Many managed hosts provide a user-friendly log viewer that highlights errors and lets you filter by date or type.
- Error monitoring services: Services like Sentry or LogRocket can capture errors and send alerts, but they require setup and may have costs.
For a quick check, you can also use the built-in “Site Health” tool in WordPress (Tools → Site Health → Info), which sometimes shows PHP error log paths.
Frequently Asked Questions
How do I enable WordPress debug logging?
Edit your wp-config.php file and add or change the following lines: define('WP_DEBUG', true);, define('WP_DEBUG_LOG', true);, and define('WP_DEBUG_DISPLAY', false);. Then visit your site to trigger the error, and check wp-content/debug.log.
Where is the debug.log file located?
It's in the wp-content folder of your WordPress installation. The full path is typically /public_html/wp-content/debug.log on shared hosting or /var/www/html/wp-content/debug.log on a VPS.
Why is my debug.log empty?
An empty debug.log means no PHP errors were logged. This could be because the error occurred before WordPress loaded (check the PHP error log), or because the file permissions don't allow writing. Also, some hosts disable error logging entirely—check with your host.
Can I view logs without FTP access?
Yes, if your hosting control panel has a log viewer (most do). In cPanel, look for “Errors” or “Raw Access Logs”. Managed hosts like WP Engine provide a log viewer in their dashboard. You can also use a plugin that displays logs in the admin area, but it needs to be installed before the error occurs.
What is the difference between WordPress debug log and PHP error log?
The WordPress debug log captures errors that happen during WordPress execution, including plugin and theme errors. The PHP error log captures all PHP errors on the server, including those from other scripts or before WordPress initializes. Both are useful, but for plugin issues, the WordPress log is more direct.
How do I clear the debug.log file?
Open the file in a text editor and delete its contents, or use FTP to delete the file entirely—WordPress will recreate it when a new error occurs. On a server, you can use truncate -s 0 debug.log or simply rm debug.log.