Something wrong happened while you were using a plugin in WordPress (freeze, or something similar) or your website is crashing with a blank screen… or anything else? Checking your PHP Error Logs is the first reaction you should have.
The PHP Error Logs is not the Access Error Logs (which is the error related to your web server and not PHP).
This article is still being written and updated. Don’t hesitate to ask questions in the comments, we’ll try to share more useful information over time.
What is the PHP Error Logs?
PHP Error Logs contain errors related to programming errors but also memory, space, and timeout issues. They are really important to troubleshoot issues.
Please note that the PHP Error Logs is rarely empty (as warnings are also logged in them).
Where to find the PHP Error Logs?
Hosting Service Admin Panel
Usually, you can access them through the administration system shared by your hosting service (not the WordPress one; it can be Plesk, cPanel, or their own system). Here are how to find it for the famous hosting services:
- Siteground: Visit Tools, Site, File Manager. In there, you’ll find a folder called logs. For specific PHP errors, look into the public_html folder of the domain. You’ll find a php-errors.log.
Please let me know if you know how to get the PHP Error Logs for more hosting services 🙂
Through WordPress directly
If you are lucky, your PHP Error Logs are accessible through WordPress. Depending on your hosting service, it might work, or not. If the file is not found, or empty, it’s probably that it is disabled. If you can’t find them, or if they are empty and you have issues, contact your hosting service and ask them for access to your PHP Error Logs (and if they are good, for troubleshoot about your issue at the same time).
With the Meow Apps Dashboard
The Meow Apps Dashboard reads automatically, if available, your PHP Error Logs, splits it into the different warnings and errors, color those messages and display them nicely. It’s the simplest way of checking the errros. The Meow Apps Dashboard is available in all the plugins by Meow Apps (it’s a common library to all of them).
Above, the PHP Error Logs seems empty or not accessible.
With a Dedicated Plugin
There are a few plugins which are made to read the PHP Error Logs. They work the same way as the Meow Apps Dashboard, usually a bit simpler, they just display whatever is in the file. You can try Error Log Monitor.
Enable the PHP Error Logs through WordPress
There are some ways to get the errors to be written to a specific files through WordPress. This also highly depends on how your hosting service is set up, and if they allow it to be done. Please give it a try! You can simply add this in your wp-config.php file, right before the /* That’s all, stop editing! Happy blogging. */ line.
// Enable WP_DEBUG mode define( 'WP_DEBUG', true ); // Enable Debug logging to the /wp-content/debug.log file define( 'WP_DEBUG_LOG', true ); // Disable display of errors and warnings define( 'WP_DEBUG_DISPLAY', false ); @ini_set( 'display_errors', 0 );
Note: this code the one recommended officially by WordPress for debugging purposes.
There is an additional thread on StackOverflow where people are discussing this, have a look here: Where does PHP store the error log?