Home  >  Article  >  Database  >  Why am I getting the "Only One Usage of Each Socket Address" Error When Connecting to MySQL with PHP?

Why am I getting the "Only One Usage of Each Socket Address" Error When Connecting to MySQL with PHP?

DDD
DDDOriginal
2024-11-18 03:00:02890browse

Why am I getting the

MySQL/PHP Error: [2002] Only One Usage of Each Socket Address (Protocol/Network Address/Port) Is Normally Permitted

Many users have encountered the perplexing error message "[2002] Only one usage of each socket address (protocol/network address/port) is normally permitted" while attempting to connect to a MySQL database via PHP. The unique aspect of this issue is that it occurs despite Apache being fully functional.

Solution:

To resolve this error, you can modify the Windows registry settings:

  1. Navigate to HKLMSYSTEMCurrentControlSetServicesTcpipParameters in regedit.
  2. Create four new DWORDs with the following keys and values:
TcpTimedWaitDelay
REG_DWORD: 0000001e (hex)

MaxUserPort
REG_DWORD: 0000fffe (hex)

TcpNumConnections
REG_DWORD: 00fffffe (hex)

TcpMaxDataRetransmissions
REG_DWORD: 00000005 (hex)
  1. Refer to the provided screenshot for a visual representation.

Reference:

[Reference Link](https://i.sstatic.net/diJfQ.png)

By implementing these registry modifications, you can effectively eliminate the error message and restore seamless connectivity between PHP and MySQL databases.

The above is the detailed content of Why am I getting the "Only One Usage of Each Socket Address" Error When Connecting to MySQL with PHP?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn