|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #68984 php.ini: cannot disable persistent connections for PDO_MYSQL
Submitted: 2015-02-04 18:01 UTC Modified: -
Avg. Score:5.0 ± 0.0
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:2 (66.7%)
From: bugs dot php dot net at register dot conactive dot com Assigned:
Status: Open Package: PDO MySQL
PHP Version: 5.5.21 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
14 + 22 = ?
Subscribe to this entry?

 [2015-02-04 18:01 UTC] bugs dot php dot net at register dot conactive dot com
The problem has been mentioned in bug 42665, but not very clearly articulated.
You can disable persistent connections for (almost?) all database types/modules, but you can't for PDO_MYSQL (probably not for PDO in general). If a user or software package uses persistent connections by default there is no way to enforce and stop the use from admin side. 
This is a serious problem for ISPs (and maybe others) as it leaves lots of MySQL connections open for the default MySQL wait_timeout (which is 8 hours). We encountered this problem for instance with Lepton CMS which passes a hardcoded PDO::ATTR_PERSISTENT to the PDO object in its database connection class. Because of this bad practice we need an option to switch this off from admin side.
We have mitigated the problem now by changing the MySQL wait_timeout to 60 seconds, but this is not a solution and still uses more ressources than necessary.

Expected result:
There has to be an option to simply disallow any persistent connections for *any* database connection type. 

Please add an option


or whereever it may fit best.

Or honor the setting of mysqli.allow_persistent
for pdo_mysql as well.



Add a Patch

Pull Requests

Add a Pull Request

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed May 22 09:01:33 2024 UTC