|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-10-02 22:09 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 07:00:01 2025 UTC |
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