PHP Fatal error:  Uncaught Exception: SQLSTATE[HY000] [2002] Cannot assign requested address in

Nathan Riley
Nathan Riley used Ask the Experts™
on
I'm trying to figure out what this error is that I've found in my httpd error_log file.  Sometimes the site shows as not available and tracked it down to this error in the error_log:

 PHP Fatal error:  Uncaught Exception: SQLSTATE[HY000] [2002] Cannot assign requested address in ....

I'm not sure what this means, but I see that I have about 20k open when I run this command:  netstat -anlp | grep :3306 | grep TIME_WAIT -wc

I tried shortening from 60 sec to 3 sec and no change in the connections:
echo "3" > /proc/sys/net/ipv4/tcp_fin_timeout

Is that my issue, connections are not closing out quickly enough?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Distinguished Expert 2017
Commented:
Check your code to make sure that you do not leave open connections.
Check variables to see what is the max connection ...... Allowed....

The information in your question provides no other insight,
Does your php code test for the existence of an existing connection before opening a new one?

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial