ID:               36602
 User updated by:  nerve at gmx dot net
 Reported By:      nerve at gmx dot net
-Status:           Bogus
+Status:           Open
 Bug Type:         PDO related
 Operating System: Gentoo Linux
 PHP Version:      5.1.2
 New Comment:

And what is abaut a new method 
to destroy the death persistent object ?
So every user can destroy it and recreate the persistent connection
without restarting the webserver ?

Not all php users have the choise to restart the webserver if a
persistent connection is going to hell ?

Thank you
Daniel


Previous Comments:
------------------------------------------------------------------------

[2006-03-04 23:56:31] nerve at gmx dot net

Thank you for your good help ;-(,
clearly it's in the docu,
but in this case persistent connections are useles ;-(

------------------------------------------------------------------------

[2006-03-04 22:04:38] [EMAIL PROTECTED]

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

As this is documented clearly in mysql documentation -> bogus.

------------------------------------------------------------------------

[2006-03-04 09:42:24] nerve at gmx dot net

That's right, after installing the new mysql i havent testet it. 
But what to do ? I can't explicitli close the persistent connections
until apache is restartet. 
Same problem happen if mysql timeout is reached.

Can we make a solution for the php user how don't want to programm a
workaround to normal connections ? (Transparent solution in php source
code ? )

Thank's for your help.

------------------------------------------------------------------------

[2006-03-03 15:32:53] [EMAIL PROTECTED]

Libmysql client library doesn't allow reconnect by default since
version 5.0.3 (Also mysql_pconnect shouldn't work after restarting
MySQL server).

------------------------------------------------------------------------

[2006-03-03 11:26:07] nerve at gmx dot net

Description:
------------
My Site connect with PDO and PDO::ATTR_PERSISTENT => true to MySQL.
If the MySQL server is restarting or a tread of the Server is killed,
the Apache tread wich is connected cant execute any statements until
Apache was restartet.
The PDO Connect return with succes, but the first query fails with
"MySQL server has gone away". 
A MySQL Server restart was no problem with the old mysql_pconnect
function.

I want a detection on creation of new PDO object with persistent
connection if the connection is alive or a method to close the old
connection.

I use php 5.1.2 with apache 2.0.55 on gentoo linux with mysql
5.0.18-log

Please se my workaround code, witch make a fallback to slower non
persistent object.

Reproduce code:
---------------
// Workaround code for problem with pdo and persistent connection
try {
$db = new PDO('mysql:host='.$db_host.';dbname='.$db_db,
$db_user,$db_pw, array(PDO::ATTR_PERSISTENT => true));
$db->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
$db_info = $db->getAttribute(PDO::ATTR_SERVER_INFO); //  erkennung von
toten persistenten verbindungen ...
if($db_info == "MySQL server has gone away")
{
  $db = null;
  $db = new PDO('mysql:host='.$db_host.';dbname='.$db_db,
$db_user,$db_pw);
}
}catch (PDOException $e) 
{
   print "Fehler in der DB Verbindung!: " . $e->getMessage() .
"<br/>";
   $db = null;
   die();
}


Expected result:
----------------
alive persistent connection if mysql is running !

Actual result:
--------------
dead mysql persistent connection if mysql was restartet !!!


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=36602&edit=1

Reply via email to