WordPress PHP error handling and reporting in production environment

It’s best to just log errors to the server and then use bash or a server script that supports email and error analysis (instead of PHP). There are lots of log file tools out there, simple ones like Logwatch, Swatch, Octopussy, or more complex ones like Nagios.

For errors which are triggered using WP_Error you can write an email alert or log function right into the class, that is if it’s your code.

I recommend checking this out: https://github.com/pippinsplugins/WP-Logging

Additionally WP supports a maintenance.php and a db-error.php file that you can customize, the last one being more beneficial to your question since it will handle WP related DB errors.

You can of course use PHP to mail errors for example using the above: http://yoast.com/custom-wordpress-database-error-pages/

But your really better off using log files and a log analyzer to do this type of work on a production server.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)