Reputation: 2329
I'm using Zend Freamwork for my website. And sometimes i get the following exception from my website:
Message: SQLSTATE[42000] [1203] User elibrary_books already has more than 'max_user_connections' active connections
As I know "Zend Freamwork" uses PDO to connect to the database. How i can resolve this problem?
Upvotes: 4
Views: 8099
Reputation: 66
Always close your connection. If you are using Sql class it looks like:
$sql->getAdapter()->getDriver()->getConnection()->disconnect();
Upvotes: 2
Reputation: 4397
Try setting the persistent flag in your database driver configuration to be false:
resources.db.params.persistent = 0
Upvotes: 0
Reputation: 114
Sometimes MySQL connection thread is not thrown away even though you've torn down the socket cleanly; it still hangs around waiting for it to be reaped.
Check your settings for wait_timeout
. Default value is unreasonably long. Optimal value might be around 20 seconds. You will probably also want it this low if you're using persistent connections.
Upvotes: 1