Forum

Thread tagged as: Error

Random "Could not connect to the database" errors every now and then

Hi,

First of all I want to thank you for a great product, it's been a lifesaver for me! Now I only have one problem, the connection and database works fine but every now and then I get the "Could not connect to the database. Please check that the access details specified in /perch/config/config.php file are correct." error when saving an item in a region or something like that. When I click "Try again" once or twice, it usually let's me back in but takes me to the front page (Pages overview). It's quite annoying because obviously it loses all unsaved text/data if it gives the error when trying to save an item with text for example.

So are there some fixes/tweaks I can do to get rid of these random database connection errors? Or is the problem with my host? My site is running on hostinger's best (Business) subscription plan.

Kind regards, Tomi

Tomi Tähti

Tomi Tähti 0 points

  • 4 years ago
Rachel Andrew

Rachel Andrew 394 points
Perch Support

I would suggest looking in your error log. This sounds more like a hosting issue than anything else if you are losing connection to the database.

We would also need to see your Diagnostic Report to comment further.

Hi Rachel!

Thank you for your quick response. Here is the diagnostics report (Censored sensitive information from filepaths with *****, shouldn't be needed to diagnose the problem):

Health check

  • Perch is up to date
  • PHP 7.0.21 is up to date
  • MySQL 5.5.5-10.1.25-MariaDB is up to date
  • Image processing available

Summary information

  • Perch: 3.0.8, PHP: 7.0.21, MySQL: mysqlnd 5.0.12-dev - 20150407 - $Id: b5c5906d452ec590732a93b051f3827e02749b83 $, with PDO
  • Server OS: Linux, litespeed
  • Installed apps: content (3.0.8), assets (3.0.8), categories (3.0.8), perch_blog (5.6), perch_forms (1.9.1)
  • App runtimes: <?php $apps_list = ['perch_forms','perch_blog' ];
  • PERCH_LOGINPATH: /perch
  • PERCH_PATH: /home/*****/public_html/perch
  • PERCH_CORE: /home/*****/public_html/perch/core
  • PERCH_RESFILEPATH: /home/*****/public_html/perch/resources
  • Image manipulation: GD Imagick
  • PHP limits: Max upload 256M, Max POST 256M, Memory: 512M, Total max file upload: 256M
  • F1: 0c66c2e1f82f9e0b7617b2cb8270f2c7
  • Resource folder writeable: Yes
  • HTTP_HOST: *****
  • DOCUMENT_ROOT: /home/*****/public_html
  • REQUEST_URI: /perch/core/settings/diagnostics/
  • SCRIPT_NAME: /perch/core/settings/diagnostics/index.php

Kind regards, Tomi

Rachel Andrew

Rachel Andrew 394 points
Perch Support

Is there anything in your PHP error log?

As I say, if you are losing connection to the database then this is unlikely to be a Perch issue.

Hi Rachel,

I'm not sure where I can find the log, trying to figure that out at the moment. I have also opened up a ticket with my host and asked them to investigate this problem too. I'm quite sure you are right, it really seems to be a problem with my host as Perch is just using the database and every now and then the connection cannot be established. Seems like it could be some configurations on my host's end that blocks the connection. I just wanted to get your opinion regarding the problem. I'll let you know what information my host can dig up with their investigation.

Kind regards, Tomi