Jump to content

Wake-On-LAN/Sockets script stopped working after 5.2.8 upgrade


deeem

Recommended Posts

Recently upgraded our PHP install from 5.2.0 to 5.2.8. Everything continued working without a hitch, except one script... The Wake-On-LAN one. This script was written by someone else (I have a feeling I originally got it off this forum) and barely changed for my use:

 

function WakeOnLan($mac)
{

// Create Magic Packet

for($i=0;$i<6;$i++)
	$packet .= chr(255);

$mac_byte = explode(':', $mac);

for($i=0;$i<6;$i++)
	$mac_addr .= chr(hexdec($mac_byte[$i]));

for($i=0;$i<16;$i++)
	$packet .= $mac_addr;


// Set to UDP broadcast

$sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
socket_set_option($sock, SOL_SOCKET, SO_BROADCAST, TRUE);
socket_sendto($sock, $packet, strlen($packet), 0, '255.255.255.255', 9);

socket_close($sock);

return;

}

$mac = $_GET['pcid'];
WakeOnLan($mac);

 

It exits on the socket_create without generating an error, even with error_reporting set to E_ALL. Have checked the usage of socket_create on the PHP site, but all seems in order.

 

This is PHP running under IIS6 on Win2003 as an ISAPI module.

 

Can anyone offer any help?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.