Files
kratos/README.md
T
2026-06-13 00:14:25 +01:00

2.2 KiB

Kratos (PHP Wake-on-LAN)

A simple PHP web app to wake configured machines on your network.

Requirements

  • Linux server
  • PHP 7.4+ (PHP 8.x also works)
  • A web server (Apache or Nginx) or PHP built-in server for local use
  • wakeonlan command installed on the server
  • ping command available on the server

Install dependencies on Debian/Ubuntu:

sudo apt update
sudo apt install -y php php-cli wakeonlan iputils-ping

Configuration

  1. Copy this project to your server.
  2. Edit hosts.php and set your own hosts:
    • mac_address: device MAC address
    • ip_address: device IP address
    • friendly_name: name shown in the UI

Run locally (quick test)

From the project directory:

php -S 0.0.0.0:8080

Then open:

  • http://<server-ip>:8080/

Deploy as a PHP application

Option 1: Apache

  1. Put this project in your web root (example: /var/www/kratos).
  2. Ensure Apache and PHP are installed.
  3. Create a vhost pointing DocumentRoot to the project folder.
  4. Enable the site and reload Apache.

Example minimal Apache vhost:

<VirtualHost *:80>
    ServerName kratos.local
    DocumentRoot /var/www/kratos

    <Directory /var/www/kratos>
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/kratos_error.log
    CustomLog ${APACHE_LOG_DIR}/kratos_access.log combined
</VirtualHost>

Enable and reload:

sudo a2ensite kratos.conf
sudo systemctl reload apache2

Option 2: Nginx + PHP-FPM

  1. Put this project in /var/www/kratos.
  2. Install nginx and php-fpm.
  3. Create an Nginx server block and point it to the project root.
  4. Reload Nginx.

Example minimal Nginx config:

server {
    listen 80;
    server_name kratos.local;

    root /var/www/kratos;
    index index.php;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php-fpm.sock;
    }
}

Notes

  • The web server user must be allowed to run wakeonlan and ping.
  • If status checks always fail, verify firewall rules and ICMP availability.
  • Keep this app on your trusted local network or behind authentication/VPN.