At Creative Group we have several high traffic PHP web shops. If a web shop is offline for just a couple of minutes, we lose a lot of money. When there’s a technical problem, error messages are very important to fix it asap. We discovered that just using set_error_handler()
and set_exception_handler()
is not enough, as in some situations the PHP error handler is not called. In this post I would like to share some practices we’ve implemented throughout the years to prevent this:
- Register error handler first
- Catch fatal errors
- Catch errors raised during error handling
- Prevent memory exhaustion during error handling
- Respect PHP settings