Re: die function
| From: | Jason Barnett | Date: | Mon, 21 Mar 2005 14:20:07 +0000 |
| Subject: | Re: die function | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-211187@lists.php.net to get a copy of this message | ||
Barbara Picci wrote:
> Hi all,
>
> I have a machine that must insert in cron in a mysql db in another
> remote machine.
> The problem is that I cannot know if the connection in the first machine
> (adsl) go down because no entry in the machine log is generated. I would
> like to redirect the die function in a e-mail that say me what happens.
I think the way you want to solve this problem is to create a customized
error handler. Check out this link:
http://php.net/manual/en/function.set-error-handler.php
<?php
function email_error_handler($level, $msg, $file, $line) {
switch ($level) {
/** E_ERROR, E_USER_ERROR, etc. */
mail_to_admin("$level: $msg in $file on line $line");
}
}
function mail_to_admin($msg) {
/** stuff */
}
?>
--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc