mysql connection has gone away

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
jazz090
Forum Contributor
Posts: 176
Joined: Sun Apr 12, 2009 3:29 pm
Location: England

mysql connection has gone away

Post by jazz090 »

im trying to upload files into mysql but for files bigger than 1 mb, it throws that error. So i did a little reasearch and they mostly said change max_allowed_packet in mysql to bigger size. i did that and i still get this error. any ideas?
Defiline
Forum Commoner
Posts: 59
Joined: Tue May 05, 2009 5:34 pm

Re: mysql connection has gone away

Post by Defiline »

im trying to upload files into mysql
It is very, very BAD.
Do NOT do that EVER :)
ldougherty
Forum Contributor
Posts: 103
Joined: Sun May 03, 2009 11:39 am

Re: mysql connection has gone away

Post by ldougherty »

Generally this is not a good idea as you don't want to store large file(s) in a database.

If you are getting the message, it is not due to a setting or limit. The message means you have lost connection to the mySQL server which could be due to many different reasons but likely just server performance.
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: mysql connection has gone away

Post by Benjamin »

Well what's the error? Did you restart MySQL after changing the size? Are the PHP memory limit and, max post size and max upload size settings too low? And the previous post is correct. What you ought to be doing is storing the file name in the database, not the actual file.
Post Reply