From: j8859 at clix dot pt Operating system: Linux Slackware 10.2 PHP version: 5.1.3 PHP Bug Type: PDO related Bug description: "MySQL server has gone away", with PDO::ATTR_PERSISTENT => true
Description: ------------ This error also occurs with PHP 5.1.2, but with more frequency than with 5.1.3. It occurs only if I use PDO::ATTR_PERSISTENT => true, and it never occurs with PDO::ATTR_PERSISTENT => false. I have several databases in MySQL, several programs in PHP some using the classic MySQL functions, others using MySQLi, and one using PDO. This is the one which produces errors. The MySQL version is 5.0.18. Apache/1.3.34. If I do a MySQL Flush Tables, the error stops. With PHP 5.1.2 I also need to do an Apache restart to get the error stop occurring. The error never occurred with few MySQL tables opened. I do a diary crontab backup with mysqldump, over the night, and in the morning there are about 220 opened tables. Then, when I use my PDO application, I start getting "MySQL server has gone away" errors. I changed to PDO::ATTR_PERSISTENT => false and the error never happened. I changed back to PDO::ATTR_PERSISTENT => true and the error returned. I know this can be difficult for you to reproduce it, because it is not a deterministic error, but I'm sure there is an error. Reproduce code: --------------- $bd = new PDO(); $query = "SELECT * FROM mytable"; $inst = $this->prepare($query); if(!$inst) die ("ERROR: " . $query . ", " . __FILE__ . ", " . __LINE__); if(!$inst->execute()) { $inst->closeCursor(); return; } while($reg = $inst->fetch(PDO::FETCH_ASSOC)) { // Process $reg } $inst->closeCursor(); $bd = null; -- Edit bug report at http://bugs.php.net/?id=37319&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=37319&r=trysnapshot44 Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=37319&r=trysnapshot51 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=37319&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=37319&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=37319&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=37319&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=37319&r=needscript Try newer version: http://bugs.php.net/fix.php?id=37319&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=37319&r=support Expected behavior: http://bugs.php.net/fix.php?id=37319&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=37319&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=37319&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=37319&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=37319&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=37319&r=dst IIS Stability: http://bugs.php.net/fix.php?id=37319&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=37319&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=37319&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=37319&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=37319&r=mysqlcfg