Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

11
  • 31
    This solution does much more for me than top rated answer. The top-rated answer will send you an email every time the script runs, even if there is no error. This one strictly runs on a fatal error.
    – kmoney12
    Commented Mar 26, 2013 at 1:04
  • 1
    @periklis, if the last error was already handled, error_get_last would still return it wouldn't it?
    – Pacerier
    Commented Jul 12, 2013 at 12:49
  • @Pacerier I'm not sure what you mean with "handled", as errors are not exceptions, but I suppose the answer is "yes"
    – periklis
    Commented Jul 12, 2013 at 13:10
  • 4
    @Pacerier I see, that's an interesting question. Have a look at php.net/error_get_last, one of the comments mentions that "If an error handler (see set_error_handler ) successfully handles an error then that error will not be reported by this function."
    – periklis
    Commented Jul 12, 2013 at 13:38
  • 1
    Perhaps this is obvious, calling register_shutdown_function() must be earlier than any fatal error. use_1T_memory(); /* memory exhausted error here! */ register_shutdown_function('shutDownFunction'); won't work as expected.
    – Nobu
    Commented Mar 25, 2016 at 23:32