Welcome Guest, Not a member yet? Register   Sign In
Error Handling - send message to site admin

I am new to error handling and CI, I am trying to determine if when an error occurs is it possible for code igniter not only to log the problem as PHP does, but to also send the error to the site admin as an email?
If this is possible is it difficult and can anyone point me in the direction to start.

Kind regards

Hi John,

You need to be a little more specific - what type of error?

Hi thanks for your reply. Basically I want to capture any errors that the site generates and mail them to me.
In a non-CI site, I would do something like:

function myErrorHandler($errno, $errstr, $errfile, $errline)
$msg="error level: {$errno} {$errstr}";
mail('[email protected]','Site has errored',$msg);


This way rather than outputing the problems to the users browser, it sends me an email instead.

In some of my code, I may also use the following:
trigger_error("Value at position $pos is not a number, using 0 (zero)", E_USER_NOTICE);

The above is not my code but modified examples off PHP.net just as an example of what I am trying to achieve.
I was wondering if I can easily modify code igniter to mail any errors to me.


Theme © iAndrew 2016 - Forum software by © MyBB