Many times, working on servers we don’t own, we might find our script just died and said nothing… (one might expect a Wilhelm scream at least).

Well… Easy solution. Just enable display_errors on the server.. what ? you can’t ? ok… Then, use ini_set to enable it.

That should do it. But wait… what if you don’t want all the world know your script is screwing something up ? Or what if your script died just because, and you need to know right away ? (i.e. A constantly running process)

Well, then you can register a shutdown function (Php 4, and 5). What is it ? Exactly what the name says. Whenever the script “shutdowns” , this function will execute.

A simple shutdown function, that will check for the last error (assuming the script died because of one) and if that error was fatal, print which error, what message it gave, and in which program it happened.

Then you can forward to your database… mail…. sms…. or just ignore it.