Forum Moderators: coopster
"
Fatal error: Cannot redeclare sort() (previously declared in /home/xyz124/public_html/abc.com/linkdata/processing.php:235)
"
Is it possible to suppress the output of the full path (/home/xyz124/public_html/abc.com/) and only display
"
Fatal error: Cannot redeclare sort() (previously declared in linkdata/processing.php:235)
"
Is there any server wide setting?
log_errors to 1 (true)
error_log to some file you have access to.
Then all the useful info from error tracking is there, but only you can see it.
See
[us3.php.net...]
In fact, you can write custom error messages if you know where the error will occur using the die() [php.net] construct as in
$x = sort($y) or die("Could not invoke sort");
Note that this only works with expressions, so you can't do
function sort($x) or die
{
function definition
}
You can write your own custom error handlers (see link provided by ergophobe earlier, sample code is on that page). However, fatal errors are a different animal. Here you are trying to redefine an internal PHP function, sort() [php.net]. But, how about a simpler example? Let's test the old "undefined constant" issue...
<pre>Now we don't show the path anymore.
<?php
error_reporting(0);
print HELLO . "\n";
function userErrorHandler($errno, $errmsg, $filename, $linenum, $vars)
{
echo $errmsg . "\n";
}
$old_error_handler = set_error_handler("userErrorHandler");
print HELLO . "\n";
exit;
?>
</pre>
This is simply a trimmed-back version of the full example function offered in the manual pages referred to earlier.