Support » Fixing WordPress » Supressing WordPress Error Page

  • Sometimes, unfortunately, stuff happens and the database server goes down or is slow to respond and WordPress generates an error page letting me know.

    This in itself isn’t that bad, but I do consider it a (minor) security threat to have WordPress report the URL of my SQL server to users when it’s down. Is there any way to suppress this?

Viewing 3 replies - 1 through 3 (of 3 total)
  • I use the following code in my .htaccess file to suppress the error messages and log those errors to the server log instead:

    php_flag log_errors on
    php_flag display_errors off

    The only downside is that the visitor will get a blank white page if there is a fatal error. I believe your host does need to allow .htaccess settings to over-ride the php.ini values for this to work, you can also add add/change similar values in the ini file to achieve the same results.

    Good luck,

    Thanks for the prompt reply, Michael! I’ll give it a shot. 🙂

    Edit: Hmm… I still seem to be getting the WordPress error. The message is actually being served by WordPress; that is, it’s not really a PHP error message.

    > Is there any way to suppress this?

    In /wp-includes/wp-db.php on line 18, change

    var $show_errors = true; to
    var $show_errors = false;

    It looks like that change will make WordPress die with an empty page instead of the error message (haven’t tried it).

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Supressing WordPress Error Page’ is closed to new replies.