$res = socket_connect($socket, $addr, $port);
here are noobs instructions
go to your php installation directory in windows it can be something like this c:xamppphp
the goto ext direction in it phpext
check if your have php_sockets.dll in that directory
after that open php.ini file which will be in your php folder
next search for ;extension=php_sockets.dll
if you find it then remove ; from it
if you not find it then search for extension=
and then below some extension add extension=php_sockets.dll
and finally restart your apache.
This answer assumes you do have a php_sockets.dll extension file accessible (in your PHP installation extension directory or where required);
If you're using windows, just uncomment the following line in your php.ini file:
;extension=php_sockets.dll
If you are missing the php_sockets.dll, you can download it from php.net.