MySQL/PHP Error:[2002] Only one usage of each socket address (protocol/network address/port) is normally permitted(MySQL/PHP 错误:[2002] 每个套接字地址(协议/网络地址/端口)通常只允许使用一次)
问题描述
我已经在 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 HD、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:
HKLMSYSTEMCurrentControlSetServicesTcpipParameters
HKLMSYSTEMCurrentControlSetServicesTcpipParameters
并创建 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] 每个套接字地址(协议/网络地址/端口)通常只允许使用一次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:MySQL/PHP 错误:[2002] 每个套接字地址(协议/网络地址/端口)通常只允许使用一次


- 从 PHP 中的输入表单获取日期 2022-01-01
- 如何定位 php.ini 文件 (xampp) 2022-01-01
- Mod使用GET变量将子域重写为PHP 2021-01-01
- Laravel 仓库 2022-01-01
- 正确分离 PHP 中的逻辑/样式 2021-01-01
- PHP Count 布尔数组中真值的数量 2021-01-01
- SoapClient 设置自定义 HTTP Header 2021-01-01
- 带有通配符的 Laravel 验证器 2021-01-01
- 没有作曲家的 PSR4 自动加载 2022-01-01
- Oracle 即时客户端 DYLD_LIBRARY_PATH 错误 2022-01-01