max_allowed_packet and my.ini

There are two major issue with PHP, MySql and Apache combination when dealing with database dump or executing a SQL through phpMyAdmin – one that you are not allowed to upload a SQL file more than a specific limit and secondly, you keep getting following error again and again –

   1: MySQL Server has gone Away - Error 2006

I am working on Windows Vista and using phpMyAdmin as interface to MySQL.


To fix upload problem, you need to update upload_max_filesize variable inside php.ini file. By default, it is set to 2M (2 MB). I have changed it to 170M in order to accompany the files I am dealing with.


In order to keep MySQL functioning properly and not throwing errors like 2006 which comes up because of extremely large queries, set max_allowed_packet = 20M which is 1M by default. You can check value of variable by executing following command on MySQL prompt –

   1: show variables like 'max_allowed_packet';


In addition, to save your session timing out quickly, you can also consider changing max_execution_time variable in php.ini and LoginCookieValidity inside of phpMyAdmin.


There are more settings which can be referenced in order to keep all these things working properly. I am linking all the files with this post –