Turn on E_ALL Error Reporting
| From: | Roger Spears | Date: | Thu, 18 Mar 2004 16:43:02 +0000 |
| Subject: | Turn on E_ALL Error Reporting | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-180851@lists.php.net to get a copy of this message | ||
Hello,
I changed the title of this email so it doesn't thread hijack...
I use a simple function like this to turn on and show warnings and errors. It's my understanding though, if the error is catastrophic, it will not be displayed on the screen no matter what you do. Not sure about that though...
I did not create this function, nor am I taking credit for it. I'm sharing it. I think it came from one of my many PHP books, possibly the PHP Cookbook...
<?php
function pc_error_handler($errno, $error, $file, $line, $context)
{
$message = "[ERROR][$errno][$error][$file:$line]";
print "<p>$message<br>";
?>
<p><a href="mailto:youraddress@yourhost.com?subject=<?php print $message; ?>">email this error</a>
<?php
print "</p>";
}
error_reporting(E_ALL);
set_error_handler('pc_error_handler');
?>
This will show the warning/error on the screen and provide a link for the viewer to use to report said error. You must replace "youraddress@yourhost.com" with your email address.
HTH,
Roger