To run the class I posted yesterday, I typically use a class called DaemonRunner. This class sets up for proper signal handling, and ‘executes’ the class extended from Daemon.
declare(ticks=1); class DaemonRunner { public static function exec($className) { $argv = $_SERVER['argv']; $daemon = new $className($argv); $daemon->init(); while (!$daemon->isDone()) { $daemon->run(); } $daemon->shutdown(); } } . . . → Read More: PHP on the Backend (part 2)