At the startup of the docker application (with laravel php), for 1 request, connection to database is fine. After the first request I start to get this error.
SQLSTATE[08006] [7] could not send SSL negotiation packet: Resource temporarily unavailable (Connection: pgsql, SQL: (select * from ........)
Using:
- Laravel v10 and above.
- PHP 8.3 and above
- Docker with Ubuntu Latest
I tracked down this problem until I found out that PDO is actually not openning a connection to PostgreSQL. I tested it with iptraf and both pg_connect and PDO. When we use PDO, we get the error above and but when I try to use pg_connect, we can connect and even make a query.
So my findings are, when using iptraf
- Cannot open a connection using PDO
- IPTraf does not show connection openned with PDO
- I can open a connection using pg_connect
- I can open a connection from a database manager application
- Happening on both development and production environments
[EDIT] New findings:
- The whole setup is working on a virtual machine rather then a docker.