Undetected PHP Errors

We spoke a great deal about all detected errors. But how about those which cannot be detected but can do severe damages to your site? For example, take the case of malicious attacks by some plugin or theme using php code. Some themes do come with such code. How to do we monitor such PHP errors?

Solution

PHP error-logging is the solution. We need to create a log file and place it on the server, preferably in a secured place like above the root directory. Name the file (for example errorslist.log). Later, add this piece of code to wp-config.php file.

@ini_set(‘log_errors’,’On’);
@ini_set(‘display_errors’,’Off’);
@ini_set(‘error_log’,’/home/path/logs/errorslist.log’);

This is how we can get list of errors and their details in the log file.