|  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: bugs dot php dot net at register dot conactive dot com
New email:
PHP Version: OS:


 [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: Tue May 28 19:01:31 2024 UTC