PHP error logs are essential for diagnosing issues on your WordPress site. Whether you’re troubleshooting a broken plugin, theme conflict, or a blank white screen, the error log can help you pinpoint the exact problem.
To check PHP error logs in a WordPress site, you can follow the steps below depending on your hosting environment and configuration:
1. Enable WP_DEBUG in wp-config.php
Edit your wp-config.php
file and add (or modify) the following lines above the line that says /* That's all, stop editing! Happy publishing. */
:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false ); // Prevents errors from showing on frontend
WP_DEBUG
: Enables debug mode.WP_DEBUG_LOG
: Writes errors to a file calleddebug.log
.WP_DEBUG_DISPLAY
: Hides errors from being printed on the frontend.
Once enabled, WordPress will log PHP errors to:
/wp-content/debug.log
2. Check debug.log
Navigate to your site files (via FTP, cPanel, or your local file system) and look for:
/wp-content/debug.log
Open this file with a text editor to see PHP notices, warnings, and errors.
3. Check Your Hosting Provider’s Error Logs
Most hosting panels (like cPanel, Plesk, or managed WordPress hosts) provide access to raw PHP error logs.
For cPanel, go to Metrics → Errors or Logs → Error Log.
For other hosts, you will usually find this in the hosting dashboard.
4. Check Server-Level PHP Error Logs
If you have root or SSH access (VPS, cloud, or dedicated server), you can access logs directly:
- Apache (Ubuntu/Debian):
/var/log/apache2/error.log
- Nginx with PHP-FPM:
/var/log/php7.x-fpm.log
- General PHP logs (as configured in
php.ini
):error_log = /var/log/php_errors.log
5. Using a Plugin (Optional for Beginners)
If you prefer a UI-based approach, install a plugin like:
These plugins read from wp-content/debug.log
and display errors within the WordPress dashboard.
Leave a Reply