webdevops / Dockerfile

:package: Dockerfiles from WebDevOps for PHP, Apache and Nginx
https://webdevops.io/projects/dockerfiles/
MIT License
1.67k stars 492 forks source link

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

Open dersonsena opened 1 year ago

dersonsena commented 1 year ago

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 =)

Petrucheqa commented 1 year ago

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

Petrucheqa commented 1 year ago

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

Blomster1 commented 10 months ago

Thx this has been helpful for me !