How to keep a MySQL connection alive
Ok, so I wasted about 3 hours on this, and have only sort of found a solution. I have a PHP script which is going to be running 24/7 checking a message queue and then interacting with a database when a message is received. It was mostly working, until it sat there for a day and I tried to use it the next day. The PHP script had quit, with the error "MySQL server has gone away." I figured there must be some sort of time limit that the mysql server will keep an idle connection alive. I couldn't find it, but luckily I was talking to nick, and he did! He found this blog entry. So I changed the my.cnf file to set the timeout to one week:
continue reading...