1

We have an older cron script written in PHP that runs for months at a time. It is still using mysql_pconnect to connect to the MySQL server. The connection to MySQL is started when the script starts and it only connects once. After several months, this script will eventually fail because the MySQL-link Resource is no longer valid. I'm having a hard time searching on what the maximum lifetime of this connection is or how to change it.

Example warnings:

Warning: mysql_close(): -2147483648 is not a valid MySQL-Link resource in /home/savvior/powerbuy/library/dblayer.php on line 29

Warning: mysql_select_db(): -2147483648 is not a valid MySQL-Link resource in /home/savvior/powerbuy/library/dblayer.php on line 2

LinuxGnut
  • 393
  • 8
  • 18
  • Possible duplicate of [how to change timeout for mysql persistent connections](http://stackoverflow.com/questions/4948004/how-to-change-timeout-for-mysql-persistent-connections) – Dekel Oct 05 '16 at 17:10
  • 1
    It may be worth noting that number is the 32-bit max integer + 1 – cOle2 Oct 05 '16 at 17:11
  • @cOle2 I think you are onto something there you sleuth – Drew Oct 05 '16 at 17:13
  • My suggestion is to find the developer of that script and make him/her listen to nails scratching on a blackboard until they fix the script to not execute for months on end. What in the heck is this thing doing anyways? Is upgrading to PHP 7 an option? Because you could trim 5 months down to 2.5 if you're lucky. – MonkeyZeus Oct 05 '16 at 17:16

0 Answers0