Reputation: 140132
I've tried restoring connections in $_SESSION,
but can only reuse for one user.
Any better solutions?
Upvotes: 0
Views: 1608
Reputation: 27934
Read about mysql_pconnect()
.
Unfortunately, persistent connection is not stable in PDO and not supported by MySQLi.
Persistent connections save time when the database server is not in the localhost, but if it is, use of persistent connections is practically irrelevant.
Upvotes: 5
Reputation: 66931
What do you mean be "reuse connections"? A connection is a socket being opened to the server..of course you can't store it in $_SESSION. It still would have to reconnect, so it would be pointless anyways. The closest you can come to it is persistent connections.
Upvotes: 5