<?php
declare(ticks=1);
$pid = pcntl_fork();
if ($pid == -1) {
die("could not fork");
} else if ($pid) {
exit(); } else {
}
if (posix_setsid() == -1) {
die("could not detach from terminal");
}
pcntl_signal(SIGTERM, "sig_handler");
pcntl_signal(SIGHUP, "sig_handler");
while (1) {
}
function sig_handler($signo)
{
switch ($signo) {
case SIGTERM:
exit;
break;
case SIGHUP:
break;
default:
}
}
?>