|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38996 PDO persistant connection breaks on mysql restart
Submitted: 2006-09-29 19:13 UTC Modified: 2006-10-02 22:09 UTC
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: fifthnormal at hotmail dot com Assigned:
Status: Closed Package: PDO related
PHP Version: 5.1.6 OS: Linux
Private report: No CVE-ID: None
 [2006-09-29 19:13 UTC] fifthnormal at hotmail dot com

I am using PDO as a database layer to connect to MySQL. I add the attribute to use a persistant connection. This works as expected

If the MySQL server is restarted, then PHP responds with this error message:

SQLSTATE[HY000]: General error: 2006 MySQL server has gone away

From this point on the connection won't work. This error message will only go away after httpd has been restarted.


Daniel Burge

Reproduce code:
//Run this to ensure that the connection is being made and persisted, then restart your mysql database
$dbh = new PDO("mysql:host=dbserver;dbname=databasename","username","password", array(PDO::ATTR_PERSISTENT => true));

Expected result:
I would expect that PDO would reestablish the connection if it drops. 

Actual result:
PDO returns the error message:

SQLSTATE[HY000]: General error: 2006 MySQL server has gone away


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-10-02 22:09 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sat Jun 03 16:03:34 2023 UTC