0

Possible duplicates: Connection pooling in PHP and php connection pooling mysql

I used to restore connections in $_SESSION.

but found it not good.

3
  • @ricebowl: His question is: 'How to implement database connection pool in PHP?' Commented Aug 30, 2009 at 13:38
  • you need to implement apache module. Commented Oct 6, 2012 at 8:09
  • look for swoole/openswoole and connection pooling Commented Jun 2, 2022 at 12:14

2 Answers 2

3

It is impossible to implement a database pool in php, because each request runs in a completely new process. There is nothing that survives between requests. The library may have its own database pool (In the mysql api, it's called persistent connections). For mysql, it's moot point though, since the cost of establishing a new connection is minuscule.

Sign up to request clarification or add additional context in comments.

1 Comment

this is not the case anymore. use swoole/openswoole to gain connection pool and many many other async enterprise features.
-1

It is not minuscule, database connection is the most time consuming step while connecting to DB irrespective of the technology.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.