Php – MySQL/PHP Error:[2002] Only one usage of each socket address (protocol/network address/port) is normally permitted

apacheMySQLPHPxampp

I couldn't find a solution to this already on stackoverflow, most other related topics had to do with Apache not starting first and getting this error. My issue is that after apache is running some of my users that are connected to our php/mysql website will receive this error:

PHP Warning:  mysql_connect() [function.mysql-connect]:
[2002] Only one usage of each socket address (protocol/network address/port)
is normally permitted.

This seems to be totally random and when I monitor my worker threads for Apache, there are typically lots of idle workers available to accept new connections/requests.

My Site is running on Windows XP SP3, Xampp 1.7.7, Quad Core, 4gigs of RAM, 1TB HD, Specs for php/mysql:

Apache/2.2.21 (Win32) mod_ssl/2.2.21 OpenSSL/1.0.0e PHP/5.3.8 mod_perl/2.0.4 Perl/v5.10.1

Any help on what I should change in any of my configurations to make this go away would be greatly appreciated. I've looked on google and even on Xampp forums but most people experience this issue prior to launching Apache, but Apache is running fine for me when users are experiencing this error.

Best Answer

you can modify windows REGISTRY to fix that,

first in regedit open this path:

HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters

and create 4 new DWORD as this key and values:

TcpTimedWaitDelay
REG_DWORD: 0000001e (hex)

MaxUserPort
REG_DWORD: 0000fffe (hex)

TcpNumConnections
REG_DWORD: 00fffffe (hex)

TcpMaxDataRetransmissions
REG_DWORD: 00000005 (hex)

like with this screen shot:

enter image description here

reference

Related Topic