Catching Fatal PHP Errors

When I am not mucking about with Quartz Composer and interesting electronic bits and bobs, I work as a web developer. I came across a problem recently where some of the work I was doing on one site affected another on the same server. As I wasn't watching the log files of the other server, I was unaware of the problem - not good!

PHP has functions built in for dealing with errors, but these don‘t extend to Fatal Errors and Parse Errors. What to do? The Apache error log mechanism where the PHP errors end up can cope with being given a program instead of a file. So some dubious shell scripting later, I now have a program that appends the result to the correct error file as usual, but also checks to see if the error contains either of the strings ’PHP Parse‘ or ’PHP Fatal' and if so, emails the error to me.

Problem solved - instant notification (contact me if you want the script)!

SteamSHIFT out.

Technorati Tags:
osx, server, developing, php, error

Copyright © 2013 - Brothers Bennettw - Powered by Hexo
- Ported theme GreyShade -