Search your drive for php.ini (although it's likely just underneath the wamp install directory) and open it.
Find the following line:
CODE
;extension=php_sockets.dll
Delete the leading semi-colon (which comments that line out).
Save the file.
Enjoy socket goodness. For example this program:
php
<?php
$socket = socket_create(AF_INET, SOCK_STREAM, getprotobyname("tcp"));
if (!$socket)
{
die("Socket creation failed: " . socket_last_error());
}
if (!socket_connect($socket, "208.67.217.230", 80))
{
echo("Socket connect failed: " . socket_last_error());
socket_close($socket);
exit();
}
$request = "GET / HTTP/1.1\r\nHost: www.google.com\r\n\r\n";
if (!socket_send($socket, $request, strlen($request), 0))
{
echo("Socket send failed: " . socket_last_error());
socket_close($socket);
exit();
}
$response = "";
if (!socket_recv($socket, $response, 8192, 0))
{
echo("Socket recv failed: " . socket_last_error());
socket_close($socket);
exit();
}
echo ("Received $response \n");
socket_close($socket);
?>
Returns:
CODE
C:\Documents and Settings\Jack>\wamp\bin\php\php5.2.6\php.exe -f sock.php
Received HTTP/1.0 200 OK
Cache-Control: private, max-age=0
Date: Mon, 23 Feb 2009 02:57:18 GMT
Expires: -1
Content-Type: text/html; charset=ISO-8859-1
Set-Cookie: PREF=ID=c9a669240fbcea34:TM=1235357838:LM=1235357838:S=byc9eIiH5Mc4K
GQl; expires=Wed, 23-Feb-2011 02:57:18 GMT; path=/; domain=.google.com
Server: gws
X-Cache: MISS from .
Via: 1.0 .:80 (squid)
Connection: close
C:\Documents and Settings\Jack>