In this article we will demonstrate the method to enable WordPress error reporting on a WordPress website. Thanks to PHP error reporting, no error can happen without being logged. When you want to get help from support staff, it will be very helpful if you can tell them about errors.
Different error types
PHP errors start with following words:
Notice: Your website is telling you “You probably shouldn't be doing what you're doing, but I'll let you do it anyway”
Warning: this time it says “You are doing something wrong and it is very likely to have bigger issues in the future, so fix it quickly”
Fatal Error: it’s the worst scenario! It is simply telling you “Your website is completely broken”.
When you load your website and you see a white screen(nothing loads up) or you see “500 internal error”, it means that a fatal error occurred.
Hiding Notices or Warnings
If you are getting a warning or a notice, you can simply hide them. To do that please follow these steps:
- Go to WordPress installation on your server and find wp-config.php file in root directory of WordPress
- Look for "define('WP_DEBUG', false);" ( the value can be false or true )
- Now replace it with following block of code
ini_set('log_errors','On'); ini_set('display_errors','Off'); ini_set('error_reporting', E_ALL ); define('WP_DEBUG', false); define('WP_DEBUG_LOG', true); define('WP_DEBUG_DISPLAY', false);
Now your WordPress website won’t show errors, but it will log them all.
Finding log files
Now the question is where are the log files?
You can find them in following directories:
1 - Beside "wp-config.php" file there is a file named “error.log” or “debug.log”
2 - In "wp-content" folder there is a file named “debug.log”
3 - In "wp-admin" folder there is a file named “error.log”
You can check those files with any text editor to see what’s the issue on your website.
Investigating 500 internal server error
If you are getting 500 internal server error or a white page is loaded you should open "wp-config.php" and set:
So you can simply see the error on browser.