I have a web application. When upload an image to server I has converted that to base64 string, but when I inserted that to database is show an error "MySQL server has gone away". Because image string is to long, I think. So I tried using "$compressed = gzdeflate($param['image'], 9);" to compess that but not success. Anyone can help me to fixed it ?
Thanks for your time ?
The MySQL server has gone away (error 2006) has two main causes and solutions:
my.cnf
configuration file is large enough.To fix, you can increase the maximal packet size limit
max_allowed_packet
inmy.cnf
file, eg. setmax_allowed_packet = 128M
, thensudo /etc/init.d/mysql restart
.The max_allowed_packet variable can be set globally by running a query.
SET GLOBAL max_allowed_packet=1073741824;
To change the setting for everyone until the server restarts