php / php-src

The PHP Interpreter
https://www.php.net
Other
37.58k stars 7.7k forks source link

Possible bug with PHP PDO and with PostgreSQL #14665

Closed gofish543 closed 5 hours ago

gofish543 commented 2 weeks ago

Description

https://stackoverflow.com/questions/78669556/possible-bug-with-php-pdo-and-with-postgresql/78670026#78670026

What information do you need?

PHP Version

PHP 8.2.20

Operating System

Ubuntu 22.04 LTS

JDare commented 2 weeks ago

I've noticed the same issue on a production server (Ubuntu 22) which got updated to PHP 8.3.8 running laravel 11.x connecting to postgres (16.2).

davidldear commented 2 weeks ago

More info as well. We are seeing this on various Laravel apps across PHP 8.2/8.3 and Ubuntu 22/24 while connecting to Postgres.

yoyoyeahyoyo commented 2 weeks ago

Usage: /usr/bin/php-config [OPTION] Options: --prefix [/usr] --includes [-I/usr/include/php/20220829 -I/usr/include/php/20220829/main -I/usr/include/php/20220829/TSRM -I/usr/include/php/20220829/Zend -I/usr/include/php/20220829/ext -I/usr/include/php/20220829/ext/date/lib ] --ldflags [-L/usr/lib/php/20220829 ] --libs [-lcrypt -lrt -lm -lxml2 -lssl -lcrypto -lpcre2-8 -lz -lsodium -largon2 -lrt -ldl -lcrypt ] --extension-dir [/usr/lib/php/20220829] --include-dir [/usr/include/php/20220829] --man-dir [/usr/share/man] --php-binary [/usr/bin/php8.2] --php-sapis [cli fpm phpdbg ] --phpapi [20220829] --ini-path [/etc/php/8.2/cli] --ini-dir [/etc/php/8.2/cli/conf.d] --configure-options [--includedir=/usr/include --mandir=/usr/share/man --infodir=/usr/share/info --disable-option-checking --disable-silent-rules --libdir=/usr/lib/x86_64-linux-gnu --libexecdir=/usr/lib/x86_64-linux-gnu --disable-maintainer-mode --disable-dependency-tracking --prefix=/usr --enable-cli --disable-cgi --disable-phpdbg --with-config-file-path=/etc/php/8.2/cli --with-config-file-scan-dir=/etc/php/8.2/cli/conf.d --build=x86_64-linux-gnu --host=x86_64-linux-gnu --config-cache --cache-file=/tmp/buildd/nonexistent/config.cache --libdir=${prefix}/lib/php --libexecdir=${prefix}/lib/php --datadir=${prefix}/share/php/8.2 --program-suffix=8.2 --sysconfdir=/etc --localstatedir=/var --mandir=/usr/share/man --disable-all --disable-debug --disable-rpath --disable-static --enable-dtrace --with-pic --with-layout=GNU --without-pear --enable-filter --with-openssl --with-password-argon2=/usr --with-external-pcre --enable-hash --with-mhash=/usr --with-libxml --enable-session --with-sodium --with-system-tzdata --with-zlib=/usr --with-zlib-dir=/usr --enable-pcntl --with-libedit=shared,/usr build_alias=x86_64-linux-gnu host_alias=x86_64-linux-gnu CFLAGS=-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -O2 -Wall -pedantic -fsigned-char -fno-strict-aliasing -DOPENSSL_SUPPRESS_DEPRECATED -g] --version [8.2.20] --vernum [80220]

PDO doesn't work. pg_connect works. PDO errors: with sslmode='disable'

Running command: $pdo = new PDO($dsn, null, null, [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]); Errors: With sslmode 'disable' SQLSTATE[08006] [7] could not send startup packet: Resource temporarily unavailable With sslmode 'require' SQLSTATE[08006] [7] could not send SSL negotiation packet: Resource temporarily unavailable Its happening in newly created aws and digital ocean ubuntu servers with laravel forge server management. build flags shown above for one of them.

devnexen commented 2 weeks ago

Weird I see no change in pdo pgsql between those releases (8.2.20/8.2.19). About Docker, were they always the same images or were they updated as a whole ?

yoyoyeahyoyo commented 2 weeks ago

Temp fix setting this up as a service: socat TCP4-LISTEN:{PORT},fork TCP4:{EXTERNAL_HOST}:{EXTERNAL_PORT} Which details that the loopback connections work. Its specifically the connection to another interface where it fails.

Weird I see no change in pdo pgsql between those releases (8.2.20/8.2.19).

I made a build of php 8.2.19, and it had the same bug, however I can't confirm which pdo_pgsql this build was running.

devnexen commented 2 weeks ago

between php 8.1 and php 8.2 there is no real major changes, pgsqlGetnotify mind you but that s past the connection.

yoyoyeahyoyo commented 2 weeks ago

Here are some packages that were updated with the unattended-upgrades around the time pdo stopped working: google-chrome-stable libcups2 php8.0-swoole php8.2-swoole This swoole issue has the same error message swoole/swoole-src#5374

Update: I replaced php8.2-swoole 6.0.0-2 with version 5.1.3 configured with "--use-openssl" flag, and did not get this error when using pdo_pgsql. I don't think it is a problem with pdo_psql. But I don't know what is causing it. The swoole version on this ticket (swoole/swoole-src#5374 ) is 5.1.2 and the same error .

github-actions[bot] commented 5 hours ago

No feedback was provided. The issue is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so. Thank you.