简体   繁体   中英

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.

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.

We can use PgBouncer . This has been answered in another question .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM