#38996 [Opn->Csd]: PDO persistant connection breaks on mysql restart

From: Date: Mon, 02 Oct 2006 22:09:54 +0000
Subject: #38996 [Opn->Csd]: PDO persistant connection breaks on mysql restart
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-103017@lists.php.net to get a copy of this message
ID: 38996 Updated by: tony2001@php.net Reported By: fifthnormal at hotmail dot com -Status: Open +Status: Closed Bug Type: PDO related Operating System: Linux PHP Version: 5.1.6 New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [2006-09-29 19:13:28] 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 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=38996&edit=1

« previous php.bugs (#103017) next »