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_PERSISTENT => true)
);
The mySQL wait_timeout
variable is set to 28800
and I left the script on idle for 12 hours for test purposes; and the connection is dropped automatically so I presume the PDO::ATTR_PERSISTENT
attribute is superseded by the system variable wait_timeout
.
So I was wondering whether theres a setting or another PHP method to keep the connection breathing as long as the PHP script is running and whether or not that would be a good practice.
My plan B would be executing a resource-less mySQL query every 60 minutes to reset the clock.
OS: 4GB RAM VPS Debian 64 Bit SSD