I've changed pgsql.allow_persistent
to Off
in /etc/php.ini
, and restarted apache.
Now I'm getting identical pg handles for two consecutive pg_connect
.
Array
(
[0] => Resource id #14
[1] => Resource id #14
)
My question is, is php still using persistent connections, and what should be done if answer is yes.
PHP caches connections within any given script run, so multiple connect calls with the same params will return the same connection.
Unlike persistent connections this caching only occurs within a single script run.
As you found, you can disable this caching with the force new flag - PGSQL_CONNECT_FORCE_NEW.