Modifying WordPress custom database error connection page

connection has a big role when we build using a dynamic webpage. To be more spesific, if we’re using WordPress it’s always a good thing to have our database connection alive. But, for some technical situation, database connection might be dropped. Like or not, this is the situation we might have.
To deal with high-traffic , there is a plugin (note: we’re talking about WordPress here) called WP Super Cache. This plugin will help your WordPress to deal with major traffic, to keep our alive e.g. when our site got a massive traffic from site like Digg or Slashdot. When there is a failure on MySQL database connection, there will be a page presented informing about problem on establishing database connection. A page that we want to avoid. The worst thing is that when this ‘temporary’ page is indexed by .

Reading what Derek Punsalan mentioned about custom error database connection page, his updated tutorial is very interesting. I mean, we (actually) can modify that page into something better. In short, to have a custom page for database connection error page, just create a called db-error.php and put it under your /wp-content/ directory. That’s it.
I made one. Here are few things I had in mind when I built it (I am using WordPress 2.5 right now).

  • I do not want to tell (exclusively) about the database problem.
  • But, I want to tell visitors that there is something does not run well.
  • I want to keep them informed about this site. So, if search engines/other sites send to my site — but it is not available — they know that actually they come to a right place.
  • The page should not call any database connection (of course!).
  • Lastly, I want to have a better page.

Anyway, the error message will be shown on a current accessed page. If they’re at the front page, they will have a same page when open a permalink or archive page. To see what happened when this site has a database connection problem, look at the screenshot. Of course, I hope that I do not to display this page.
If you want to use my db-error.php, I’ve uploaded the file so that you can customize it. Download now (2 Kb).

4 replies on “Modifying WordPress custom database error connection page”


To deal with high-traffic website, there is a WordPress plugin ..

hehe.. i have no high-traffic website, but iam using WP Super Cache.
i’ll try.. thank you Bang..

Well, i got no luck dealing with WP-Cache or Super Cache plugin…when i install WP-Cache, my WP crashed peacefully, made me have to delete the plugin manually through FTP, and restore the WP-Config.php file… :(
But thank you for the tips :D

adien, me too. I do not have WP cache-related plugins here right now. The custom error page I mentioned here is just an alternative when something goes wrong with database connection even it is related to traffic or not.
gagahputera, I think you’re unlucky then… Or, probably you do not need that plugin right now… :)

nice idea, keren euy…dah lama ga maen kesini, terakhir pake MT sekarang udah bikin tips WP aja, keren mas Thomas, btw ta comot dulu ahh kebtulan lagi mbenerin template…