64x64 icon dark hosting
Get a Tuts+ subscription for just $45! Deploy New Relic now to claim.
Advertisement

Quick Tip: Email Error Logs with PHP

by

In today's video quick tip, we'll review the process of setting custom error handlers with PHP. Along the way, we'll also learn how to log and email those potential errors to ourselves. That way, even when your web application has been deployed, you'll be the first to know when an error is encountered.


Intro


Source


Conclusion

If you decide to set your own error handlers, make sure that you:

  • Determine whether or not to die() and kill the page.
  • Provide some level of feedback for the user. If there was a fatal error, let them know in some form!
  • You don't want to email yourself errors when debugging. You can create a $debug variable that, if set to true, we'll bypass the process of emailing you the error, and will, instead, echo the error onto the page. If you need a code snippet for this, just let us know!
Advertisement