Jump to content

Blob Files larger than 2MB on Windows/Apache/MySQL/asp/php system


Mule

Recommended Posts

I took the non-working code from http://www.devarticles.com/c/a/MySQL/Blobbing-Data-With-PHP-and-MySQL/1/ and fixed the errors.  I am able to upload any file from 1kb-1.99mb successfully.  If I try to upload any file 2mb or larger it spits out "Couldn't connect to database server"  I have my php.ini sections set correctly, or so I think (file_uploads are on, upload_max_filesize is 80M [should it be 80000000 instead?], upload_temp_dir is set and works, and my sql's my.ini file has max_allowed_packet=80M).

 

**Keep in mind this is a Windows XP machine running apache/MySQL/asp/php**

 

I have attached a .txt file with all of my modified php scripts that I am using somewhat successfully...I really need your help people!

 

-Mule

 

[attachment deleted by admin]

Are you sure about the exact error message? It is unlikely that the size of the uploaded file would cause an error when a mysql_connect() statement is executed unless there was an overall resource problem.

 

Add the following two lines after your first opening <?php tag -

 

ini_set ("display_errors", "1");
error_reporting(E_ALL);

 

and change your or die() statement so that mysql/php tells you why if failed -

 

or die("Couldn't connect to database server" . mysql_error());

As a secondary rule of thumb:

 

Don't store binary data in SQL. Not smart.

 

Look up the tons of arguments against it (Primary argument: You have a file system designed specifically for that purpose - Why add further layers to the file-fetching process?).

I found the source of the problem (and boy am I embarassed).

 

PFMaBiSmAd, I added the code that you suggested, cleared out my log files, and restarted my services.  When the blasted "Couldn't connect to database server" message appeared again I shut down my laptop and left the office for lunch.  When I returned I removed the code snippits you suggested earlier and tried to upload a 2M file again (to make sure things were properly broken hi, hi).  The file uploaded with no error!

 

After trying this and that I found the culprit - Before posting to this group I made the change to my SQL's my.ini file and restarted my apache and associated services...idiot me forgot that php and apache restarted but MySQL needed to be restarted by hand.

 

Thanks for your reply at any case.

 

awpti, I am well aware of the "arguments" with blob files.  I am a road warrior and want an all inclusive database system rathern than trying to remember to migrate the linked data files every time I jump from one machine or MySQL system to the next while using my thumb drive.  besides those PCs may have various mapped drives and I simply don't have time reconfiguring the database links or the mapped drives on those machines.  But thanks for your input none-the-less.

 

-Mule

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.