问题描述
我已经在 stackoverflow 上找不到解决方案,大多数其他相关主题都与 Apache 没有首先启动并出现此错误有关.我的问题是在 apache 运行后,我的一些连接到我们的 php/mysql 网站的用户将收到此错误:
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.
这似乎完全是随机的,当我监控 Apache 的工作线程时,通常有很多空闲的工作人员可以接受新的连接/请求.
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.
我的网站在 Windows XP SP3、Xampp 1.7.7、四核、4gigs 内存、1TB 硬盘、php/mysql 规格上运行:
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
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
对于我应该在我的任何配置中更改什么以使其消失的任何帮助将不胜感激.我曾在 google 甚至 Xampp 论坛上查看过,但大多数人在启动 Apache 之前都会遇到此问题,但当用户遇到此错误时,Apache 对我来说运行良好.
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.
推荐答案
你可以修改 windows REGISTRY
来解决这个问题,
you can modify windows REGISTRY
to fix that,
首先在regedit中打开这个路径:
first in regedit open this path:
HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters
HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters
并创建 4 个新的 DWORD
作为这个键和值:
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)
喜欢这个屏幕截图:
这篇关于MySQL/PHP 错误:[2002] 通常每个套接字地址(协议/网络地址/端口)只允许使用一次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!