0

error_reporting(0) is used to hide error message..!!
i want to hide server message but i what to show other error msg in place of server message..!!

that can be possible..?


Thanks,,!!

3
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by network18
1

hey,

It is possible, but is a little harder thank you are thinking.

For example.

try {
mysql_connect(blah);
} catch (Exception e){
echo 'Failed to connect to sql.';
}

For system functions.

Or you can do something like this,
after hiding all error messages with error reporting.

function displayError($error){
echo 'Javascript to display error as popup or whatnot';
die(); //kill the page so it does not load anymore
}

mysql_connect($blag) or displayError('No connection to SQL server');

A bit of reading:
http://php.net/manual/en/language.exceptions.php

Hope this helps,
Nick.

0

error_reporting(0) is used to hide error message..!!
i want to hide server message but i what to show other error msg in place of server message..!!

that can be possible..?


Thanks,,!!

server messages , you mean http errors or the php errors thrown by the server.
Adding something like this in your .htaccess will show your custom error page on the http errors(in below example 404 error) -

ErrorDocument 403 /errordocs/error403.htm
ErrorDocument 404 /errordocs/error404.htm
ErrorDocument 500 /errordocs/error500.htm
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.