note 36729 deleted from function.set-error-handler by danbrown
| From: | danbrown@php.net | Date: | Mon, 18 Oct 2010 16:16:43 +0000 |
| Subject: | note 36729 deleted from function.set-error-handler by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-173253@lists.php.net to get a copy of this message | ||
Note Submitter: mlemos at acm dot org
----
PHP does not really provide a way to catch all errors including parsing errors or for instance form
file uploading errors.
Ideally, there should be a way to catch these errors and mail a system administrator so he can take
immediate action.
The best you can do is to disable all output of errors to the pages and enable error logging to a
file. Then you should take a look at this error log file periodically to figure what may be wrong.
The problem is that you can't just wait and sit there watching for errors in the log files
until they happen. To solve this problem you may want to try this class that lets you watch a given
error file periodically and mail the new log lines to a given address of the site developer or
system administrator.
http://www.phpclasses.org/logwatcher
It is like the Unix tail command except that you should run this from a cron task periodically (lets
say, every 5 minutes). The class keeps track of the last log line that was read on each log file
poll, so it knows where to resume checking the log file on the next time the cron task is run.