PHP Wake On Lan

From ip tuning
Jump to: navigation, search

PHO Wake On Lan - Wake devices using Magic Packets

   Copyright (c) 2014 by Barry Schiffer

   Original code:

   Additional changes Copyright (c) 2014 by Manuel Azevedo <azevedo.manuel[at]gmail[dot]com>

Version 1.0 - 5th November 2014


This tool allows you to wake network devices using a WOL Magic Packet.


  • Web server with PHP installed
    • Tested with a Synology DSM 5.0


  • There is no confirmation if the Magic Packet was received by the device. Pinging the device after sending the Magic Packet could be an option;
  • Apple MACs support WOL only in sleep mode - if the machine is shutdown, it will not start with a Magic Packet;

Configuration steps

Use config.php to change the application parameters;

The following options can be configured:

$sitename The site name
$port UDP port to send the Magic Packet
$networkbroadcast The broadcast address of the network[1]
$maclist An array with the MAC addresses. Format "hostname" => "XX:XX:XX:XX:XX:XX",[2]

Sample configuration parameters are on the file config.php.


PHPWOL on a web browser: host selection PHPWOL on a web browser: sent Magic Packet PHPWOL on an iPhone


PHP, HTML, CSS and PNG files (zip)

  1. Please note that Magic Packets are broadcasted in the network. WOL usually only works in the same network segment of the server. The broadcast address usually is the last address of the network.
  2. The application supports MAC addresses in any of the following formats: XX:XX:XX:XX:XX:XX, XX-XX-XX-XX-XX-XX, XXXX.XXXX.XXXX or XXXXXXXXXXXX.