Forum Moderators: coopster

Message Too Old, No Replies

max allowed packet

php mysql error

         

brancook

3:19 am on Aug 17, 2007 (gmt 0)

10+ Year Member



I'm getting the following error when trying to upload a 15MB file into a mysql database with php. I have a php.ini file set at follows:

upload_max_filesize = 50M
post_max_size = 50M
max_execution_time = 300
max_input_time = 300
memory_limit = 32M

but I get this error:

Database error storing file: Got a packet bigger than 'max_allowed_packet'

is there any way to fix this?

dreamcatcher

6:22 am on Aug 17, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Can you increase the max_allowed_packet size?

[dev.mysql.com...]

dc

brancook

11:36 am on Aug 17, 2007 (gmt 0)

10+ Year Member



I'm not sure if I can or not. Is that something I need to check with my hosting company on. I've tried doing alot of searching for that error on Google but I can't seem to find any fixes. At least fixes that I understand.

dreamcatcher

6:30 pm on Aug 17, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Not really sure to be honest. A search reveals its in the following file:

my.cnf/my.ini

Not really sure where thats located? Maybe contact your host?

dc

brancook

8:16 pm on Aug 17, 2007 (gmt 0)

10+ Year Member



It looks like according to my host I need to upgrade my package in order to be able to make that adjustment to the max_allowed_packet. Is there any way around this or I'm I pretty much stuck with that. Instead of uploading the large file to the database can I upload it to a folder on the server and link to it from the database?

It just doesn't make sense that I can make all those adjustments in my php.ini file but the max_allowed_packet trumps it all.

coopster

7:34 pm on Aug 30, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Instead of uploading the large file to the database can I upload it to a folder on the server and link to it from the database?

Yes, you could, and is an oft-employed technique. Also, since

max_allowed_packet
is one of the MySQL Dynamic System Variables [dev.mysql.com] you could set it at runtime.