Home > Backend Development > PHP Tutorial > swoole如何在后台运行

swoole如何在后台运行

WBOY
Release: 2016-06-06 20:06:52
Original
2516 people have browsed it

服务端代码写完了,在命令行中执行 php server.php ,可是这样怎么能一直在后台运行呢?我把ssh客户端窗口关了,就连接不上了 后面加一个 & 也不行,要怎么样操作?r

回复内容:

服务端代码写完了,在命令行中执行 php server.php ,可是这样怎么能一直在后台运行呢?我把ssh客户端窗口关了,就连接不上了 后面加一个 & 也不行,要怎么样操作?r

screen php server.php

守护进程化。设置daemonize => 1时,程序将转入后台作为守护进程运行。长时间运行的服务器端程序必须启用此项。

如果不启用守护进程,当ssh终端退出后,程序将被终止运行。

  • 启用守护进程后,标准输入和输出会被重定向到 log_file

  • 如果未设置log_file,将重定向到 /dev/null,所有打印屏幕的信息都会被丢弃

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template