PHP/MySQL error - briefly losing connection to database


My web based application (used by multiple users [within our organisation] via web concurrently, by logging in) has suddenly developed this issue, intermittently the user while browsing it loses connection to database for fraction of second. When refreshed it comes back sometimes. It is getting pretty annoying now.

The error message is

Connection to the host is failed, perhaps the service is down.

I saw mysql_error log file and found multiple rows of such messages:

[Warning] IP address 'xx' could not be resolved: No such host is known.

[Warning] IP address 'xx' could not be resolved: This is usually a temporary error during hostname resolution and means that the local server did not receive a response from an authoritative server.

[Warning] Hostname '' does not resolve to 'xx'.

[Warning] IP address 'xx' could not be resolved: The requested name is valid, but no data of the requested type was found.

Are these two interlinked? Why these IPs (majority from China), only our ogranisation staff know of this web based tool.

Edit: It has returned after a brief hiatus. It shows a different message now

A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.\r\n in C:\xampp\htdoc\xyz\ on line 10

Line 10 in

mysql_connect($hostname, $username, $password) or die('Could not connect to database: '.mysql_error());

What could be the reason now? How to fix it?

People are also looking for solutions to the problem: php - How to send multiple requests in one curl open connection


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.