Support » Fixing WordPress » Replace “Error Establishing Database Connection” page?

  • Resolved marky


    Although rare, every now and then my database server goes down. When this happens, all my visitors are greeted with the default WordPress “Error Establishing Database Connection” page which offers troubleshooting problems for the page owner (and not necessarily the visitors). The error, for example, reveals the address of my SQL server.

    This, unfortunately, is not an appropriate face for my site. I would instead like to custom author an explanation page that the site is down for technical reasons. Is this done through the template? I can’t seem to find the right files.

    Any help will be appreciated. 🙂

Viewing 9 replies - 1 through 9 (of 9 total)
  • Hi Marky,
    I’ve actually done what you’re looking to do a couple of times, for myself and for a client.

    Based on my interactions with it, modifying the DB error page isn’t done through the template or the traditional theming methods.

    You’d actually need to modify some WP files and wouldn’t recommend it unless you felt comfortable modifying those files and could easily update it if necessary — for instance, in the event of a WP upgrade.

    Well, that’s slightly irritating, but I suppose I’m comfortable with that. Do you know the filename of the PHP file offhand?

    Also, is there a formal venue for requesting this to be added to the template functionality of WordPress?

    I don’t think it will ever be added because the normal expectation from a host is that their DB server is up and running…
    You can do a search/find on your computer in the WP files to find the displayed text.

    And if the database can’t be found, WP won’t know where its template files are anyway.

    Or do something with .htaccess to force a redirect to a custom 404 page?

    Sorry, I usually don’t bump threads, but does anyone have any instructions?

    I realize that, ideally, it’s safe to assume a working database is in place, but realistically, there are situations where this isn’t the case.

    yes marky. I do 🙂

    look at /wp-includes/wp-db.php, Line 46. It begins there.

    And dont sweat it, I changed all that junk too, eons ago. wp-db.php is not surprisingly, one of the few core files that hasnt underwent drastic rewriting from the various updates. If youve got a good diff utility available keeping it “changed” from update to update wont be hard.

    Awesome; thank you very much whooami. 🙂

    youre welcome, I appreciate the need to customize those “error” pages, trust me 🙂

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Replace “Error Establishing Database Connection” page?’ is closed to new replies.