"Mysql has gone away" + drupal + lighttpd = you're toast

Joeri Poesen //

You may or may not, at some point, encounter the error message “Mysql has gone away” splattered across your page dozens of times. When you do, you will wonder what happened. You will install a clean Drupal 5.X, try to register a new user and hit dirt.

You will loose time trying to figure it out and you will not find a solution. You will just remove lighttpd and install apache. You will feel sad that you had to chuck out your darling little speedy lighty, but at the same time you will feel relieved that you’re once again under the safe wings of a stable (yet resource hungry) http server.

Note: This problem seems to happen often on ubuntu + lighttpd + mysql5 + php5 + Drupal 5.x. For me, it started happening after upgrading from ubuntu feisty go gutsy.

Making changes to php.ini and/or my.cnf/my.ini as described in http://drupal.org/node/186384#comment-284542 did not work. My version of lighttpd was 1.14.18 – the latest stable release at the time of writing.