-
Notifications
You must be signed in to change notification settings - Fork 390
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
如何给hprose的server做守护进程daemon? #27
Comments
一样的,你同样做这样的设置就可以了。 |
在hprose/hprose-php里全文搜索了'daemon',没有这个设置项吧? |
是 swoole 的设置,使用 hprose-swoole 就可以了。 |
解决了,参考http://rango.swoole.com/archives/59 加个daemonize的方法 function daemonize()
{
$pid = pcntl_fork();
if ($pid == -1) {
die("fork(1) failed!\n");
} elseif ($pid > 0) {
//让由用户启动的进程退出
exit(0);
}
//建立一个有别于终端的新session以脱离终端
posix_setsid();
$pid = pcntl_fork();
if ($pid == -1) {
die("fork(2) failed!\n");
} elseif ($pid > 0) {
//父进程退出, 剩下子进程成为最终的独立进程
exit(0);
}
}
daemonize();
$server = new Server("tcp://0.0.0.0:1314");
$server->addFunction("hello");
$server->start(); |
原来你用的是 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
如题,像swoole的server是可以设置参数
"daemonize" => true
,那么hprose呢?The text was updated successfully, but these errors were encountered: