I use set_error_handler. It works for most cases, except fatal errors. Follow this thread for possible solution (hack): http://stackoverflow.com/questions/277224/how-do-i-catch-a-php-fatal-error