Page 1 of 1

Can't connect to database - while being logged in in Hesk?!

Posted: Tue Jan 17, 2017 6:06 pm
by jaapvdv
Script URL: https://helpdesk.eisergon.nl
Version of script: 2.6.6
Hosting company: -
URL of phpinfo.php: https://helpdesk.eisergon.nl/info.php
URL of session_test.php: ?
What terms did you try when SEARCHING for a solution: Can't connect to database

Write your message below:

Earlier today I was logged in to the backend of Hesk to reply to a ticket. Upon sending the reply Hesk surprised me with the error 'Can't connect to database'.
Initially I got this error in the Hesk GUI.

Later when reloading Hesk it showed me the error message directly in a text only page.

Other websites accessing the same db-server have no problem. Accessing the db-server (MySQL) using the credentials in the Hesk settings file works without a problem (so that rules out incorrect credentials). Any idea?

Kind regards,

Jaap van der Veen

Re: Can't connect to database - while being logged in in Hesk?!

Posted: Tue Jan 17, 2017 6:41 pm
by Klemen
Not sure what is going on, but this usually means the DB server is rejecting connections. Perhaps you have too many active connections to the database (not just from Hesk, but site-wide)?

To get more info about what is happening try this:

1. backup existing files
2. download hesk_settings.inc.php
3. open it in a powerful text editor, such as Notepad++
4. change

Code: Select all

$hesk_settings['debug_mode']=0;
to

Code: Select all

$hesk_settings['debug_mode']=1;
5. save, upload and test

The error message should now give more details.

Re: Can't connect to database - while being logged in in Hesk?!

Posted: Wed Jan 18, 2017 6:58 am
by jaapvdv
Hi Klemen,

Thanks for replying.

I just opened Hesk, and it works!

I'll keep on eye on the DB-server though.

Regards,

Jaap

Re: Can't connect to database - while being logged in in Hesk?!

Posted: Thu Jan 19, 2017 9:02 am
by anika
Hi there,

I experience the same problem since today without changing anything.

I already changed the hesk_settings.inc.pho and now receive the following error message:
MySQL antwortet:
(2002) php_network_getaddresses: getaddrinfo failed: No address associated with hostname
Do you have an idea what is going wrong?

Thank you.

Anika

Re: Can't connect to database - while being logged in in Hesk?!

Posted: Thu Jan 19, 2017 10:18 am
by Klemen
This means PHP cannot resolve your database host name (cannot "convert" it into an IP address), so it's an underlying hosts/resolver problem on the server somewhere.

You can try entering the IP address of your MySQL server instead of hostname in hesk_settings.inc.php (backup first!) in the line starting with

Code: Select all

$hesk_settings['db_host']

Re: Can't connect to database - while being logged in in Hesk?!

Posted: Thu Jan 19, 2017 12:00 pm
by anika
Thank you, it is working again :)