I have a long running PHP script. I am making the database connection at the very beginning of the script and does some database operation at the start up.
After that, the script perform 4 hours of PHP operation without pinging to MySQL with that connection even a single time.
At the end of these long running PHP operations, when I try to execute mysql_query it gives me the following error: MySQL Server has gone Away
Is there any possibility of increasing the connection timeout to be 4 hours? I am using PHP ADODB to connect with MySQL from my PHP application.
Please suggest what to do?
MySQL has a different timeout than PHP. You could increase it in
php.inion the linemysql.connect_timeout = 14400. Also increase thedefault_socket_timeout = 14400Note that if your PHP setting allow you to do an
ini_set, you can also do as follows: