Re: die function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux