Re: losing mysql connection during cron job

From: Date: Thu, 19 Jun 2008 05:43:17 +0000
Subject: Re: losing mysql connection during cron job
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-275572@lists.php.net to get a copy of this message
> Thanks for the suggestion. I am currently successfully working around > this error by another method, although your suggestion is probably better. > > The reason I posted this problem, though, is that I want to understand > *why* I'm getting the "Lost connection to MySQL server during query" error. > > If anyone has had a similar experience using cron jobs or sleep() I'd > love to hear from you. - database is restarted for whatever reason (log rotation, dba does an upgrade etc etc). - mysql has a 'wait_timeout' setting which could trigger it http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html#option_mysqld_wait_timeout You need to do a mysql_close(); mysql_connect(...) before mysql_query works again - otherwise mysql_connect will just return the same resource id (or I guess just use the 'new_connection' flag for mysql_connect and skip the mysql_close()). -- Postgresql & php tutorials http://www.designmagick.com/

« previous php.general (#275572) next »