php.net |  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
Votes:1
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
Description:
------------
Hello,

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.

Thanks,

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


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-10-02 22:09 UTC] tony2001@php.net
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
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 30 14:01:28 2024 UTC