I am running an endless PHP Script with PDO Persistent Connection like this:
$conn=new PDO(
\'mysql:host=127.0.0.1\',\'user\',\'pass\', array(PDO::ATTR_PER
I would suggest you another way to handle such situations. Whenever you need to run a query in your long-lasting script ensure that there is a connnection. Otherwise reconnect.
try {
echo "Testing connection...\n";
$old_errlevel = error_reporting(0);
self::$pdo->query("SELECT 1");
} catch (PDOException $e) {
echo "Connection failed, reinitializing...\n";
self::init();
}
You can find the full class example here. I also suggest you to explicitly close the connection in your script when you know you will not use it for a long period.