MineAdmin icon indicating copy to clipboard operation
MineAdmin copied to clipboard

[QUESTION] macOS15.5. swoole6. 开启设置work数为1 php watch 热更 进程数莫名多了

Open adaipan opened this issue 6 months ago • 2 comments

i9(8核16线程) macos 15 swoole6 开启work数为1 php watch 热更 通过ps auc|grep php 有17个 热更就会出现端口被占用情况

adaipan avatar May 17 '25 19:05 adaipan

Thanks for opening your first issue here! Be sure to follow the issue template! 感谢您在这里反馈第一个问题!请务必遵循问题模板!

boring-cyborg[bot] avatar May 17 '25 19:05 boring-cyborg[bot]

Hello @adaipan! I'm Dosu, here to help you tackle bugs, answer questions, and navigate your way to becoming a contributor. I'm glad to assist while you wait for a human maintainer. How can I help you today?

在 macOS 上运行 MineAdmin 时,可能会出现进程数意外增加的问题,尤其是在使用 Swoole6 并设置 worker 数为 1 的情况下。以下是一些可能的解决方案和注意事项:

  1. Worker 数配置: 确保在 config/autoload/server.php 中正确配置了 Constant::OPTION_WORKER_NUM。在调试模式下 (APP_DEBUG 为 true),worker 数应为 1,否则应根据 CPU 核心数设置 [1]

  2. 进程管理脚本: 检查 php watch 命令的进程管理脚本,确保 killOldProcess()forceKill() 函数正确终止旧进程。这些函数会尝试通过 PID 文件和命令行强制终止进程 [2]

  3. 端口配置: 确保 .env 文件中的 VITE_APP_PORT 设置为未被占用的端口,默认值为 2888。同时检查 docker-compose.yml 中的端口配置,避免与其他服务端口冲突 [3][4]

如果这些配置和脚本没有解决问题,可能需要进一步检查 Swoole6 在 macOS 上的已知问题或限制,特别是与进程管理相关的部分。

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

dosubot[bot] avatar May 17 '25 19:05 dosubot[bot]

推荐用 hyperf/watcher

zds-s avatar Jul 29 '25 06:07 zds-s