webdevops/Dockerfile

PDO corruption in php-nginx-dev:8.1-* images on Mac

dersonsena opened this issue · 3 comments

I'm using a MacBook Air M1 Ventura (13.3.1) that requires an ARM64 architecture for almost everything.

I spent some time trying to understand why a simple connection with the PDO was not working:

$pdo = new PDO('mysql:host=xxxx;dbname=xxxx', 'root', 'secret', [
    PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
]);

I had the xdebug activated and yet no errors or warnings appears in the logs, NGINX simply returned a 502 error:

<html>
<head><title>502 Bad Gateway</title></head>
<body>
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx/1.22.0</center>
</body>
</html>

The solution I found was upgrade to version 8.2 of this same package, but I believe version 8.1 is still widely used. I found it important to register this problem for the community to be able to solve it =)

Same Issue using webdevops/php-nginx-dev:8.0 image

I've spent three days looking for complicated solutions. I've found that the error comes from my docker configuration 😭

If x86 option is checked just uncheck it.

Capture d’écran 2023-07-04 à 14 36 33