AndiSHFR / wake-on-lan.php

Send magic packet from php to wake up a host using "Wake on Lan"
MIT License
87 stars 26 forks source link

wake-on-lan.php

Send magic packet from php to wake up a host using "Wake on Lan"

Wake-On_Lan Screenshot

wake-on-lan.php started as a one file drop in tool for waking up computers when they are suspended.

Note: As there where numerous issues using this code, even it worked fine in my environment, at the end of 2021 i decided to refactor the whole thing.

Changes of the 2021 Release

Requirements

Installation

Note: If you need to copy the file to a remote machine use scp or sftp.

Enabling the php sockets extension

The way the php sockets extension is enabled slidely differes with every php installation.

Here are basic steps for linux users:

Setup

Open your favorite browser and navigate to the wake-on-lan.php url. Now you can start adding your the hosts you want to wake.

General Operation

Adding a host

To add a host simply fill the edit fields at the bottom of the table and press the blue button with the plus sign.

You need to fill the follwing input fields:

Removing a host

To remove a host simply click on the trashcan icon of the host you want to remove.

Saving the configuration

You can save the configuration by choosing Tools -> Save COnfiguration.

The configuration will be saved to a json file in the same directory as of wake-on-lan.php.

The web server needs permission to write to the file. You you may need to adjust folder permission accordingly.

Tools Dropdown Menu

Caveat

Does not run under linux. Because the linux user used to run php code on the server side usually has very limited permission it cannot create the raw socket to send the magic packet.

Note: This caveat no longer applies. Using the sockets extension wake-on-lan.php no longer suffers this shortcoming.

License

wake-on-lan.php is published under MIT license.