How to BOLDLY customize “Error Establishing a Database Connection” warning message

by Barbara

stress

PrintFriendly

If you run WordPress for your site, chances are that every now and then, the following delightful message shows up.

"Error Establishing a Database Connection!"

Gosh, I hate that, don't you?

Well, given that not everyone knows you can reload a page and possibly grab that connection back, *my* site says:

dberror How to BOLDLY customize “Error Establishing a Database Connection” warning message

Neat, eh?

Here's how I did it – it's easy, it's free, and I'll give you the file you need at the end!


arrow How to BOLDLY customize “Error Establishing a Database Connection” warning message
Step 1.)  Create the file db-error.php in your /wp-content/ .

You can use your domain control panel to do this.


arrow How to BOLDLY customize “Error Establishing a Database Connection” warning message
Step 2.)  In said file, put this:

<?php // custom WordPress database error page

  header('HTTP/1.1 503 Service Temporarily Unavailable');
  header('Status: 503 Service Temporarily Unavailable');
  header('Retry-After: 600'); // 1 hour = 3600 seconds

  // If you wish to email yourself upon an error
  // mail("your@email.com", "Database Error", "There is a problem with the database!", "From: Db Error Watching");

?>

<!DOCTYPE HTML>
<html>
<head>
<title>Database Error</title>
<style>
body { padding: 20px; background: white; color: black; font-size: 40px; }
</style>
</head>
<body>
<center>
Alas, might you please reload this page?  Sometimes
the Universe likes laughing at mortals like ourselves...
</center>
</body>
</html>

 

Your custom message goes between the red centers.


arrow How to BOLDLY customize “Error Establishing a Database Connection” warning message
Step 3.)  Save the file, and voila!

Whenever your WordPress has trouble connecting to the database, your custom message will show up.

You can encourage reloading, you can include a marketing message…whatever works best for *you*.

Neat, eh?

Need the full file?  Click here for db-error.txt and simply rename it to db-error.php .  :)

Knowing how to stand out from the rest of the thundering herd is a key component for your 2012 income's fitness.  To get similar secrets, check out the latest edition of Income Fitness below.

Income Fitness

You'll love what you discover.

Grow strong,

Barbara Ling

About the author

Barbara Author: Barbara Ling. 15+ Year veteran marketing entrepreneur, currently specializing in teaching others how to build a viral fanbase/community online using Facebook, Pinterest, blogging, coffee (lots of coffee, or maybe tea if that's your preference) and more! See my Google Profile here!

subscribe sticker11 How to BOLDLY customize “Error Establishing a Database Connection” warning message

FREE GIFT! My 100% Affiliate Commissions Secrets!

Digg This
Stumble Now!
Buzz This
Share on Facebook
Bookmark this on Delicious
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

No related content found.


Thank you for reading!"Hey there, thanks so much for stopping by! If you enjoyed this article, please do feel free to tell your friends about it or use those nifty neato social icons above to spread the word. I love sharing great info, and would really appreciate it...thanks!"
-- Barbara Ling

Share Your Comments - you might have to click twice to activate the comment box

CommentLuv badge

This blog uses premium CommentLuv which allows you to put your keywords with your name if you have had 3 approved comments. Use your real name and then @ your keywords (maximum of 3)

Previous post:

Next post: