-
-
Notifications
You must be signed in to change notification settings - Fork 242
Description
Bug 报告:FlyEnv 在 Windows 10 LTSC 2019 上无法正确检测 PHP 服务状态
环境信息
- 操作系统: Windows 10 Enterprise LTSC 2019 (版本 1809)
- FlyEnv 版本: 4.x (最新版)
- 系统架构: x64
问题描述
FlyEnv 界面显示 PHP 服务"未启动"(灰色图标),但实际上 PHP 进程已经正常运行并且工作正常。此问题仅在 Windows 10 LTSC 2019 上出现,同样的 FlyEnv 版本在 Windows 11 上工作完全正常。
复现步骤
- 在 Windows 10 Enterprise LTSC 2019 上安装 FlyEnv
- 启动 PHP 服务(任意版本,如 PHP 7.4.33 或 PHP 8.0.30)
- 观察界面状态指示器
期望行为
- PHP 服务状态应显示为"运行中"(蓝色勾选图标)
- 服务管理功能应正常工作
实际行为
- PHP 服务在界面中显示为"未运行"(灰色图标)
- 但是,PHP 进程实际上已经在运行:
php-cgi-spawner.exe正在运行- 多个
php-cgi.exe工作进程处于活动状态 - PHP 正在监听正确的端口(如 9074、9080)
- Web 请求被成功处理
根本原因分析
经过调查,发现问题与 flyenv-helper.exe 有关:
debug.log 中的错误:
[_fetchRawPATH][error]: Error: Connect helper failed
[_fetchRawPATH][error]: Error: exec: "powershell": executable file not found in %PATH%:
手动运行 helper 时的错误:
E:\flyenv\PhpWebStudy\resources\helper\flyenv-helper.exe --version
AppHelper terminated with error: failed to create named pipe: failed to listen on named pipe '.\pipe\flyenv-helper_sock': Access is denied.
根本原因: 基于 Go 语言编写的 flyenv-helper.exe 无法在 Windows 10 LTSC 2019 上创建 Windows 命名管道(\\.\pipe\flyenv-helper_sock),这是由于 LTSC 版本更严格的安全策略导致的。
为什么只影响 LTSC 版本
Windows 10 LTSC(长期服务渠道)是精简版的企业版系统,具有以下特点:
- 更严格的安全策略
- 移除/禁用了部分 Windows 服务
- 命名管道权限要求不同
Windows 11 和常规的 Windows 10 版本没有此问题。
验证信息
PHP 实际上正在工作:
# 进程正在运行
$ tasklist | grep php
php-cgi-spawner.exe 8756 Console 1 3,224 K
php-cgi.exe 1988 Console 1 12,328 K
php-cgi.exe 11240 Console 1 18,396 K
...
# 端口正在监听
$ netstat -ano | grep 9074
TCP 127.0.0.1:9074 0.0.0.0:0 LISTENING 8756
# Web 服务器正常响应
$ curl -I http://localhost
HTTP/1.1 200 OK
Server: nginx/1.29.3
X-Powered-By: PHP/7.4.33
<img width="1150" height="325" alt="Image" src="https://github.com/user-attachments/assets/780df7e3-57e2-47c2-9570-a2560b0200ce" />