Skip to content
Advertisement

How to establish PHP PDO connection with pooling

I want to connect a Postgres database with pooling:true. Can we do it with PHP new PDO option? If not are there any reliable options?

I want to pass the below parameters(similar) while establishing the connection:

Pooling=true;Minimum Pool Size = 2;Internal Command Timeout = 0;Command Timeout = 0;

I cannot find any such details in https://www.php.net/manual/en/ref.pdo-pgsql.connection.php

Any help will be much appreciated.

Advertisement

Answer

As far as i remember from old days of programming in PHP, You cannot have pooling in PHP as php is not threded (most of times) and each requests goes line by line. In JavaScript (node.js) you can do pooling, but not on PHP as each request is one thread.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement