MYSQL_ATTR_INIT_COMMAND causing "The FastCGI process exited unexpectedly"
Personne n'a encore pris cette issue.
- Langage dominant
- C
- Étoiles
- 40.4k
- Forks
- 8.2k
- Merge moyen
- 2 j 13 h
- PR mergées (30 j)
- 96
Description
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
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Reproduisez le crash signalé sous PHP 8.1.9 sur Windows Server 2019 avec PDO::MYSQL_ATTR_INIT_COMMAND défini sur "SET NAMES utf8mb4;", puis comparez-le avec le même constructeur sans cette option. Commencez par examiner l’issue associée 9143 et les détails fournis du journal des événements Windows ; le travail est terminé lorsque le processus FastCGI ne se termine plus de manière inattendue et que la régression est couverte par un test approprié.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- mysql, php
- Domaine
- backend, databases
- Type d'issue
- Bug
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 35/100