I’m trying to find a solution on how to handle the displaying and logging of errors in a PHP (WordPress) production environment.
Is it possible to do the following (alternative suggestions welcome):
- Capture critical errors and send immediate email notification (this looks like a promising solution, but haven’t tested in my production env yet).
- Don’t display PHP errors on screen to visitors. Instead display a custom built error page. Something that’s friendlier than the PHP “white screen of death”. This includes the WordPress specific errors, like the “Error establishing a database connection” one.
Production environment details specific to this question:
- WordPress 3.5.1
- Web Host: Windows Azure Cloud
- Web Server: IIS 7.5
What I’ve already configured:
- Development (local), Staging and Production enviroments
- Code is managed in source control (Team Foundation Server Version Control)
- Tested builds are pushed to production (Windows Azure Cloud)
-
I have configured wp-config for multiple environments:
- Development and Production connect to different databases.
-
Development configs:
- WP_DEBUG = true
- WP_DEBUG_DISPLAY = true
- WP_DEBUG_LOG = true
- display_errors (via @ini_set) = true
-
Production configs:
- WP_DEBUG = false
- WP_DEBUG_DISPLAY = false
- WP_DEBUG_LOG = true
- display_errors (via @ini_set) = false