Site crashing frequently

My site is crashing frequently, with a “Error establishing a database connection” message.
My questions are:
1. How can I identify and remedy the cause?
2. Can I set up an alert so I am notified when it happens?
3. Is there any way to set an auto reboot mechanism for when it does?
thanks, Neil.

  • Adam Czajczyk
    • Support Gorilla

    Hello Neil McEvoy

    I hope you’re well today and thank you for your question!

    Such an issue is usually a sign of

    – either very limited (too limited for the site’s needs) server resources – namely limits of the number of allowed DB queries/requests and/or concurrent connections

    – or server being rather unstable

    – or site putting way to much load on database; that often means either just too many queries or some “broken”/slow queries being performed.

    It’s difficult to say what exactly is causing it but there are few steps that could help for the start:

    – a look at “slow queries” report using Query Monitor plugin

    – check of WordPress debugging log that can be activated by setting following lines in the “wp-config.php” file of the site (right above the /* That’s all, stop editing */ line)

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

    Adding those would enable internal WP debugging. This should (especially after site goes down) generate a file named “debug.log” in a /wp-content folder and that file might contain some warnings/errors that could possibly suggest what’s causing the issue.

    If that doesn’t help, then we’d need to check the site but I’d suggest starting with those – see you can spot anything “suspicious” there.

    As for “alerts”. WordPress itself cannot alert you when it’s down because… well… it’s down :wink: But you can set Uptime monitoring since your site is already connected to The Hub and it would alert you every time it is not able to connect to the site so you could then check what’s happening.

    As for “auto reboot”. That’s a good question but it depends solely on the host and what tools they provide. I’d recommend asking your host directly about that.

    Best regards,

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.