“MySQL server has gone away” with CodeIgniter and MySQL

I’v stopped using CodeIgniter for 7 months, but I maintaining a product that was developed under CI.

rock ssd

Today I’v got a error saying  “MySQL server has gone away” after a long time PHP execution.
I’v managed to solve it by, on the model that was getting me the error, *reconnect* to the database .

Before the *command* i’v added $this->db->reconnect();

 $this->db->reconnect();
 $this->db->insert('photoGallery', $data);
 return $this->db->insert_id();

Hope it helps anyone out there.

One thought on ““MySQL server has gone away” with CodeIgniter and MySQL

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.