<?php
//切换用户
$runUser = posix_getpwnam($runUserName);
if (!$runUser) {
echo "$runUserName - No such user\n";
exit(1);
}
if (!posix_setuid($runUser['uid'])) {
echo "setuid($runUserName) failed\n";
exit(1);
}
//daemon化
if (($pid1 = pcntl_fork()) != 0) {
exit;
}
posix_setsid();
if (($pid2 = pcntl_fork()) != 0) {
exit;
}
php之daemon
最新推荐文章于 2024-03-11 17:22:46 发布