企业🤖AI Agent构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# workerman ## 端口 20005 socket端口 20014 外部通讯端口 20015 内部通讯端口 此workerman启动和CRMEB商城项目端口不会发生冲突 ## 解禁函数 ~~~ `pcntl_signal` `pcntl_signal_dispatch` pcntl_fork` `pcntl_wait` `pcntl_alarm` ~~~ ## Linux 下命令详解 ~~~ #长连接服务 php think workerman [ status ] [ server ] [ --d ] #Linux 观察者模式启动 php think workerman start 或 sudo -u www php think workerman start #Linux 进程守护模式启动 php think workerman start --d 或 sudo -u www php think workerman start --d #Linux 停止 php think workerman stop #Linux 查看运行状态 php think workerman status ~~~ ### Linux 下启动workerman步骤 1.目录切换到知识付费项目根目录,点击终端 ![](https://img.kancloud.cn/e0/b7/e0b7aea146558326f74fb3dcd646d801_3016x738.png) 2.打开终端后切到知识付费根目录 ![](https://img.kancloud.cn/b7/9f/b79f7573c962583bec60fb2c61437a70_2818x656.png) 3.执行命令检测命令查看workerman是否启动 未启动样子 ![](https://img.kancloud.cn/db/05/db0510c2265f4063f24a95dbc1dfe409_2126x424.png) 启动了的样子【**已启动workerman就不需要再次启动,若想重启请先执行关闭**】 ![](https://img.kancloud.cn/15/49/15495fac1cdcb5d183ab10ff4615575c_2458x1046.png) 4.未启动执行启动命令 ![](https://img.kancloud.cn/37/e7/37e73efb1aaf033cf8b8ff794c6483ab_2518x556.png) 关闭workerman方法【***想要重启workerman,必须先关闭***】 ![](https://img.kancloud.cn/1f/7d/1f7d8b281d87c05591349d312b0853b2_2194x268.png) ## Windows 下命令详解 ~~~ # 第一步 启动内部通讯 php think workerman start channel # 第二步 启动聊天服务 php think workerman start chat # 第三步 启动bussinessWorker 进程 php think workerman start business ~~~ **windows下双击 workerman.bat文件** ![](https://img.kancloud.cn/58/7c/587c66055f69c5b8fcd34e7fb36af0d3_1454x540.png) #### 注意事项 1. windows 下启动workerman必须得同时启动以上三条命令. 关闭服务只需要关闭命令行就可以; 2. windows下方便用户操作可直接运行 根目录下得 woekman.bat 文件;就可以启动workerman服务; 3. windows下双击 workerman.bat文件闪退,基本上是由于PHP环境变量没有配置导致得,可以查看[配置]->[PHP环境变量配置]文章进行配置; 4. 此workerman服务,已经包含**定时任务**; 5. liunx服务器上需要切换到当前项目得根目录执行启动命令,启动命令: `php think workerman start --d` 6. 需要开启 **20005,20014, 20015** 端口,宝塔设置放行端口,服务器还需放行端口规则 #### 修改端口 **注:若服务器中端口冲突可以修改端口,一个服务器中安装多套知识付费系统则必须要修改端口** 首先在**application/config.php**文件中修改对应的端口,**端口可以自行设置** ![](https://img.kancloud.cn/8c/94/8c9406b06befa0dcacf4fa7ba57a612d_3018x1672.png) * **workerman.chat**为外部通信服务端口,默认为20014 * **workerman.channel**为内部通信服务端口,默认为20015 * **workerman.text**为Register服务端口,默认为20015 * 修改后需要重启workerman才能生效