因为beyod是以PHP命令行方式运行的,为了便于操作,请将将php命令加入到系统PATH环境变量中, 具体的方法请自行网络探索吧。
php beyod.php server
输出:
Usage: beyod.php server/<start|stop|reload|status|help> [--appconfig=config_file_path]
start: start server instance
stop: stop server instance
reload: reload server graced
status: show server running status
help: show this help
--appconfig=path: customized server configuration file(default config/main.php)
extension status
event: yes
posix: loaded
pcntl: loaded
命令参数:
start: 启动服务
stop: 停止服务
reload: 平滑重启服务
status: 输出服务运行状态
help: 显示帮助
--appconfig=path 指定配置文件(默认配置文件为config/main.php)
另外,还会输出依赖扩展的加载状态,event是必须的,posix/pcntl不是必须的,但强烈建议安装。
如果输出没有问题,就可以启动服务
php beyod.php server/start
默认配置中,启动4个工作进程,并监听了4个端口 9723/9724/9725/9726,分别提供http/websocket/text echo/dispatcher Server服务,使用以下命令查看端口和进程状态:
netstat -ntpl
pstree -Ap
在浏览器中打开 http://服务器ip:9723/, 即可出现webroot目录的列表,作者作了一些美化,使用紫色主题呈现。默认的配置是启用目录浏览,不过这些都是可以配置的,无须担心。
beyod支持在同一个工作进程中监听多个端口。
因为windows下没有pcntl posix支持,所以无法以守护进程、多个工作进程形式运行,只用于开发调试。