Custom error page when connection to MySQL fails
Posted: Sat Sep 20, 2008 7:25 pm
It would be nice to be able to cutomize somehow the error message that appears when the MySQL server is temporally down.
By default AdoDB library shows message like this:
1. I created a static /page_error.html page under my website's root.
2. I edited /lib/adodb.functions.php file in the following way:
FIND
AFTER ADD
So now, whenever by some reasons MySQL server is down, the visitor sees my custom "page_error.html" instead of revealing to him the MySQL username and database name.
By default AdoDB library shows message like this:
Currently I am using this kind of trick:Database Connection Failed
Error: Access denied for user 'root'@'localhost' (using password: NO) (1045)
Function Performed: CONNECT
Host/DB: localhost/cmsms_website
Database Type: mysql
1. I created a static /page_error.html page under my website's root.
2. I edited /lib/adodb.functions.php file in the following way:
FIND
Code: Select all
function adodb_error($dbtype, $function_performed, $error_number, $error_message, $host, $database, &$connection_obj)
{
Code: Select all
include_once(dirname(__FILE__).'/../page_error.html');
exit;