Reputation: 50647
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.
Upvotes: 2
Views: 480
Reputation: 324551
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.
Upvotes: 1