Emailing Errors

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Grim...
DevNet Resident
Posts: 1445
Joined: Tue May 18, 2004 5:32 am
Location: London, UK

Emailing Errors

Post by Grim... »

Is there a way to change the php.ini so that script errors (including parse errors) are sent to an email address?

If I search Google all I get is people who can't get the mail() function to work properly :(
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

http://us2.php.net/manual/en/function.error-log.php

That's for non-parse errors, looking now for parse errors. If you have parse errors though, it shouldn't really be in production :)

:)

EDIT: Have a look at set_error_handler() and also set_exception_handler(), which is linked as an "see also:"
Grim...
DevNet Resident
Posts: 1445
Joined: Tue May 18, 2004 5:32 am
Location: London, UK

Post by Grim... »

Yeah, I know :)

It would have to be set in the PHP.ini somewhere because, of course, the parse error would stop any user-defined script from running...
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

See my edit :)
Grim...
DevNet Resident
Posts: 1445
Joined: Tue May 18, 2004 5:32 am
Location: London, UK

Post by Grim... »

I did - can't really see how it helps.
If the script has a parse error, how do I tell it what to do with that?
Grim...
DevNet Resident
Posts: 1445
Joined: Tue May 18, 2004 5:32 am
Location: London, UK

Post by Grim... »

PHP Manual wrote: The following error types cannot be handled with a user defined function: E_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR, E_COMPILE_WARNING, and most of E_STRICT raised in the file where set_error_handler() is called.
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

In that case, it most likely cannot be done. But as I said, why would it be in production if it has parse errors?
Post Reply