Today I wanted to test a tiny shell script, that didn’t do such magic stuff. It only generates a few websites, stores and storeviews and associates approximately 200 products to 4 websites. When I ran it locally I had no problems at all. But on the staging server I got the following error message when running the shell script. That’s why I had to fix this “MySQL server has gone away” – Error:
PHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 2006 MySQL server has gone away' in /var/www/vhosts/topsecret.host.com/httpdocs/releases/36/mage/lib/Zend/Db/Statement/Pdo.php:228
The solution for the “MySQL server has gone away” – error
To solve the problem, I had to change the following value in my MySQL configuration file (/etc/my.cnf)
This sets the allowed message package size to 32 MB.
Afterwards I had to restart the MySQL demon:
$> service mysqld restart
On some systems it can also be done via phpMyAdmin.
You can find more information about this MySQL setting on: