function daemon() { $child = pcntl_fork(); if($child) { exit; } posix_setsid(); chdir("/"); umask(0); return posix_getpid(); }