php.net |  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: -
Votes:4
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
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
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
Description:
------------
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

pdo_mysql.allow_persistent
or
pdo.allow_persistent

or whereever it may fit best.

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

Thanks!


Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Fri Jan 17 21:01:24 2020 UTC