Website going down every night

We are getting errors every night at around 3:00 AM giving "Error Establishing Database Connection" - it doesn't stay long, however, it's affecting our international customers mainly where it's 9:00 AM and they're working on the system. It just so happens that "Snapshot" is doing backups around that time. I don't see any error logs on this either. Is there any way to ell what's going on? Here's a shot of the facebook message I received from our customer:

  • Kasia Swiderska

    Hello tjerway,

    If Snapshot would be problem here it would rather timeout, but not shutdown database connection. However I don't exclude that Snapshot is culprit here. Can you change Snapshot time for backups or disable it to check if error will show again?
    Did you check Snapshot logs or WordPress logs? I would like to see WordPress debug.log from one day that this happen - if you can share it on dropbox that would be great.

    Also - you can try and run Snapshot manually and see if this will trigger that error.

    Let me know how it goes

    kind regards,

  • Ash

    Hello tjerway

    Are you in a VPS or shared server? In some server, it restarts once or twice a week, basically in shared server. So when the server restarts, and if any user checks your site when apache/php is started but mysql is not started yet, then the user will see database error.

    If you are in VPS, then your memory (ram) of your server is not enough for the resources your site needs to use, so mysql crashes and for some automatic script it starts again. This is risky in a way, just in case if the script can't start mysql then you need to start mysql manually and remove junk cache from your ram before proceeding.

    If you find this while creating a snapshot, that means you have debug log enabled. Enabling debug log in live site is not a good idea. The message you are seeing is just notices, no error in there (if there is error or warning, you would see Fatal error or Parse error or Warning). You can ignore notices in live site, though I am not sure from which plugin or theme the notices are being generated.

    To disable debug mode, please edit wp-config.php file and replace

    define( 'WP_DEBUG', true );


    define( 'WP_DEBUG', false );

    If you still want to keep enabled debug, then use the following:

    define( 'WP_DEBUG', true );
    define( 'WP_DEBUG_DISPLAY', false );
    define( 'WP_DEBUG_LOG', true );

    This will stop displaying debug code in the site so it will not break, but will create a file inside wp-content folder called - debug.log and write the messages in that file.

    Please let me know after disabling debugging if you can take a snapshot or not.

    Hope it helps :slight_smile: Please feel free to ask more question if you have any.


  • Nithin

    Hi tjerway,

    Hope you are doing good today. :slight_smile:

    This must have to do with snapshot or possibly another backup. Did you see errors regarding snapshot in the log files? I saw a ton of errors in there - what were all of the errors in the functions.php file?

    The errors in the log files are really odd, I'm afraid these doesn't pin point to a specific issue, and the errors are more in general. Could you please check, and confirm whether you are running Apache version 2.4.xx, if not please update the server to the latest version. It seems like like the support access is being blocked by a security plugin, so I wasn't able to check your website. Please disable the security plugin temporarily, so that we could check your dashboard.

    Could you also please check, and confirm the database prefix are correct?, as set in your wp-config.php file, also please check whether there is any extra spaces, new lines, or other stuff before opening <?php tags, as described here:

    Please let us know how that goes, so that we could get this sorted asap. Have a nice day. :slight_smile:

    Kind Regards,

  • Kasia Swiderska

    Hello tjerway,

    I was able to get in and check your Apache version - it is Apache 2.2 and not 2.4 -
    Also I was able to create test snapshot but there was no errors while doing it - did you had a chance to check if Snapshot is disabled then database connection errors is still there? On dedicated server you can also set backups - so can you ask your sys admin if server backups are also creating
    I showed error that is in the Support screen of the WPMU DEV Dash to our developers - and looks like msqli is installed but not configured correctly and WordPress is not using it. Please contact your sys admin to check it.

    kind regards,

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.