MYSQL_ATTR_INIT_COMMAND causing "The FastCGI process exited unexpectedly"
还没有人认领这个 Issue。
- 主要语言
- C
- 星标
- 40.4k
- 派生
- 8.2k
- 平均合并
- 2 天 13 小时
- 30 天内合并 PR
- 96
描述
Description
We have some PHP code that has ran fine for years under PHP 7 / IIS / FastCGI
When updating to PHP 8.1.9 we're getting "The FastCGI process exited unexpectedly"
After digging through the code we have identified the issue as follows:
When using PDO::MYSQL_ATTR_INIT_COMMAND in the new PDO() constructor - FastCGI just dies
$options = [
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
PDO::ATTR_EMULATE_PREPARES => false,
PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8mb4;"
];
$this->m_db = new PDO(
$m_PDOConnectionString,
$Username,
$Password,
$options
);
Resulted in this output:
C:\Program Files (x86)\PHP\v8.1.9.dev\php-cgi.exe - The FastCGI process exited unexpectedly
But I expected this output instead:
N/A - expected DB connection to open as normal
Only thing i can find in the windows event log is as follows:
Faulting application name: php-cgi.exe, version: 8.1.9.0, time stamp: 0x62e93213
Faulting module name: php8.dll, version: 8.1.9.0, time stamp: 0x62e93aac
Exception code: 0xc0000005
Fault offset: 0x00008fac
Faulting process id: 0x4d4
Faulting application start time: 0x01d8b3db35c39991
Faulting application path: C:\Program Files (x86)\PHP\v8.1.9.dev\php-cgi.exe
Faulting module path: C:\Program Files (x86)\PHP\v8.1.9.dev\php8.dll
Report Id: 3737167c-6b9f-48b2-bdfb-74baff4570ec
Faulting package full name:
Faulting package-relative application ID:
Removing MYSQL_ATTR_INIT_COMMAND solves the prooblem and everything starts working again.
The systax we're using here, i.e. "SET NAMES utf8mb4;" is a valid MySQL command which we've tested in mySQL workbench etc
Is this related to https://github.com/php/php-src/issues/9143 i wonder?
PHP Version
8.1.9
Operating System
Windows Server 2019
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
在 Windows Server 2019 上的 PHP 8.1.9 中,将 PDO::MYSQL_ATTR_INIT_COMMAND 设置为 "SET NAMES utf8mb4;",重现报告的崩溃,然后将其与不带该选项的相同构造函数进行比较。首先查看相关 issue 9143 以及提供的 Windows 事件日志详情;当 FastCGI 进程不再意外退出,并且该回归由适当的测试覆盖时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- mysql, php
- 领域
- backend, databases
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100