Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

WordPress

Sue Dough
Sue Dough
35,800 Points

Error Establishing Database Connection Hack

Ever had a wordpress site go down? Nothing is worst than your clients/users/members etc seeing an "error establishing database connection".

I want to share a hack with you guys.

You can add a file called db-error.php in your wp-content folder. Add the following snippet at the top of the file.

<?php header("HTTP/1.0 500 Internal Server Error"); ?>

You can then make a static HTML page with inline CSS. You could make a cool page for this error when it comes up.

Do not use us get header or get footer as your site can't connect.

<?php get_header(); ?> 

or

<?php get_footer(); ?>

Let me know if you have any questions. This is an undiscussed topic but great for building big sites with lots of traffic that can go down.