Re: Help MySQL server has gone away
| From: | David Robley | Date: | Tue, 01 Oct 2002 11:07:23 +0000 |
| Subject: | Re: Help MySQL server has gone away | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-22122@lists.php.net to get a copy of this message | ||
In article <3D98860D.1090909@attechcomputer.com>,
atampone@attechcomputer.com says...
> ok, I have a script that takes files from a HTTP post and loads them
> into a mySQL database. Whenever I try to load a file greater than a meg
> ot two, I get mySQL error #2006, MySQL server has gone away. I checked
> upload_max_filesize in php.ini and that's not the problem, also
> MAX_FILE_SIZE input tag is not the problem. Anyone have any ideas?
>
> Here the basic code that does the upload. There is some other code that
> collects other info and some error checking. I'm not hitting max
> execution time. So what gives? Thanks in advance for your help.
>
> BTW, PHP 4.2.1, my SQL 3.23.49-nt
>
> $f1=fopen($_FILES['newfile']['tmp_name'], "r");
> $file=fread($f1, $_FILES['newfile']['size']);
> $file=AddSlashes($file);
> $insertQuery = "INSERT INTO media_files SET
shortdesc='{$_POST['short']}', longdesc='{$_POST['longdesc']}', username='{$_POST['user']}', mimetype='{$_FILES['newfile']['type']}', filedata='{$file}', filesize='{$_FILES['newfile']['size']}', filename='{$_FIL
ES['newfile']['name']}',
>
> uploaded=CURDATE(), category1='{$_POST['gen']}', category2='{$_POST['category']}'
>
> ";
>
> Please help. Thanks.
> - Anthony
It's possible that the problem is with your mysql configuration - check
the value of max_allowed_packet which I think defaults to 1 meg - you
might need to increase that value.
--
David Robley
Temporary Kiwi!
Quod subigo farinam