How to Enable Sockets Extension for PHP

A socket is the backbone of network communication, it establishes the connection between client and server, as well as messages transmission between them.

In PHP, the socket extension implements a low-level interface to the socket communication functions based on the popular BSD sockets, providing the possibility to act as a socket server as well as a client.

Check if Sockets Support is enabled

The phpinfo() function displays information about Sockets. The state is determined by whether Sockets Support is enabled or disabled.

Sockets is enabled

How to enable Sockets support in PHP ?

Socket extension is packed into PHP when it is installed. However, this extension is not enabled by default. You need to enable it to start using PHP’s socket functions.

The name of this extension is php_sockets.dll. It can be found in php\ext.

php_sockets.dll in Windows’ XAMPP

To enable sockets, you need to add the following line to php.ini file.

extension=php_sockets.dll

Leave a Reply

Your email address will not be published. Required fields are marked *