WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Replace "Error Establishing Database Connection" page? (10 posts)

  1. marky
    Member
    Posted 7 years ago #

    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. :-)

  2. wpdiva
    Member
    Posted 7 years ago #

    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.

  3. marky
    Member
    Posted 7 years ago #

    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?

  4. moshu
    Member
    Posted 7 years ago #

    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.

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

  6. vkaryl
    Member
    Posted 7 years ago #

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

  7. marky
    Member
    Posted 7 years ago #

    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.

  8. whooami
    Member
    Posted 7 years ago #

    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.

  9. marky
    Member
    Posted 7 years ago #

    Awesome; thank you very much whooami. :)

  10. whooami
    Member
    Posted 7 years ago #

    youre welcome, I appreciate the need to customize those "error" pages, trust me :)

Topic Closed

This topic has been closed to new replies.

About this Topic