WordPress.org

Ready to get started?Download WordPress

Forums

Supressing WordPress Error Page (4 posts)

  1. marky
    Member
    Posted 8 years ago #

    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?

  2. niziol
    Member
    Posted 8 years ago #

    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,
    Michael.

  3. marky
    Member
    Posted 8 years ago #

    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.

  4. Sam_a
    Member
    Posted 7 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.