On Sun, Apr 10, 2005 at 10:25:58AM +0200, Bas Schulte wrote: > Hi all, > > I've been using Apache/mod_perl/MySQL combined with Apache::DBI for > years, and it has been working like a charm. However, while preparing > for a new release of the system I built, I'm getting this: > > DBD::mysql::st execute failed: MySQL server has gone away at > /opt/ttgp/dev/webapp/ttgp/smsclient/perl/sms line 111. > > This happens after several hours of idle time in the webserver.
Bas, looks like a connection timeout. Try: $dbh->{'mysql_auto_reconnect'} = 1; >From the DBD::MySQL manpage: mysql_auto_reconnect This attribute determines whether DBD::mysql will automatically reconnect to mysql if the connection be lost. Or change the connection timeout in the mysql server. > > I'm doing the general thing: use Apache::DBI (); in my startup.pl, it > just works, until now. > > Three things are different: > > - in a BEGIN block, I connect to the database, retrieve data, and then > generate perl code on the fly; Under mod_perl mysql_auto_reconnect should default to 'on', but since you connect in a BEGIN block DBI might not yet know it runs under mod_perl. Good luck, Harmen -- The Moon is Waxing Crescent (3% of Full)