Page 1 of 1

Emailing Errors

Posted: Tue Oct 25, 2005 4:02 am
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 :(

Posted: Tue Oct 25, 2005 4:06 am
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:"

Posted: Tue Oct 25, 2005 4:12 am
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...

Posted: Tue Oct 25, 2005 4:13 am
by Jenk
See my edit :)

Posted: Tue Oct 25, 2005 4:20 am
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?

Posted: Tue Oct 25, 2005 4:21 am
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.

Posted: Tue Oct 25, 2005 4:28 am
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?