Friendlier styled “Error establishing a database connection” error message
-
Hey,
I have always disliked the default unstyled “Error establishing a database connection” error message, which occurs if your db settings are incorrect or your db is offline/unreachable.
A simple solution is to run it through the existing wordpress errror handling function wp_die() to give it some simple styling. The change would be as follows (bzr diff output):
+++ wp-includes/functions.php 2009-11-12 12:21:30 +0000 @@ -2570,23 +2570,7 @@ wp_die($wpdb->error); // Otherwise, be terse. - status_header( 500 ); - nocache_headers(); - header( 'Content-Type: text/html; charset=utf-8' ); -?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" <?php if ( function_exists( 'language_attributes' ) ) language_attributes(); ?>> -<head> -<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> - <title>Database Error</title> - -</head> -<body> - <h1>Error establishing a database connection</h1> -</body> -</html> -<?php - die(); + wp_die("<h1>Error establishing a database connection</h1><p></p>"); } /**
Default error message screenshot:
http://img442.imageshack.us/img442/1049/wordpressdefaultdberror.pngStyled error message screenshot:
http://img30.imageshack.us/img30/6115/wordpressstyleddberror.png
- The topic ‘Friendlier styled “Error establishing a database connection” error message’ is closed to new replies.