More information about the Underscore mailing list

[_] Emailing PHP Errors

Simon Holliday simon.holliday at gmail.com
Wed Aug 15 13:08:51 BST 2007

On 15/08/07, Richard Davey <rich at corephp.co.uk> wrote:
>
> Hi Simon,
>
> Wednesday, August 15, 2007, 10:23:18 AM, you wrote:
>
> > For non-templated sites you can create your error handler and call
> > set_error_handler() from a new file which you would then reference
> > from PHP's "auto_prepend_file" config variable, which will ensure it
> > is included before other stuff.
>
> Just to throw a 3rd idea into the mix - you could set-up a cron job to
> email you the PHP error log once a day? Or even a couple of times a
> day if you prefer.
>
> If your site is throwing masses of errors per page then using your own
> error handler that invokes a mail send could cause a significant
> slow-down if you're not careful.
>


Yep, absolutely.

Should also add that none of these solutions would really be recommended if
you were building a new site from scratch, just quick and easy fixes for Tim
working with an existing mass of error-causing code.

A mid-way (and fourth) solution might be to log the errors to a database,
and only send an email if the error hasn't already been logged in the last X
minutes/hours/days.


Si.


--
http://simonholliday.com/