I seem to be able to upload small files to DBFM, but when I try and upload a file that is 200KB in size I get the following error message:

Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 245760 bytes) in /home/vegemite4me/public_html/subdomains/demo/sites/all/modules/dbfm/dbfm.module on line 1465

I am using

DBFM v5.x.3.0
DAPI 5.x.1.0
DBFMgreybox 5.x.1.2
jstools 5.x.0.6
PHP 5.2.5

Line 1465 of dbfm.module is:

          $query = sprintf("INSERT INTO dbfm_data (fid, fblob, fmd5, fblobmod) VALUES ('%d', '%s', '%s', '%s')",$newfid, $fblob, $metadata['fmd5'], $currentdate);

Any ideas?


rooey’s picture

Check your PHP maximum file size settings!

vegemite4me’s picture

Hi rooey, I have the WebFM module installed on the same instance of Drupal, and have no problems uploading 2MB files using WebFM. This implies to me that it is not the PHP max file size settings. (I had to edit .htaccess to add the following in order to upload the files in WebFM: php_value upload_max_filesize 10M and php_value post_max_size 20M.)

Could this be some kind of MySQL filesize/memory restriction??

rooey’s picture

Yep - it'll be a mysql thing too - but the fatal error points to a PHP memory size problem - increase those values.

When you upload a file into DBFM it is compressed automatically, so it requires a little extra memory.

rooey’s picture

also - you REALLY should upgrade to the latest version of DBFM!

geoff_eagles’s picture

I think you're right - I believe it's most likely to be a mysql setting.
Try looking in the mysql my.cnf file and increase all the likely looking settings (I can't remember them offhand but I know that packet size was a factor).
As rooey suggests, I'd be inclined to start with the latest code.

geoff_eagles’s picture

Status: Active » Closed (fixed)

Is this OK now? I'm closing.

vegemite4me’s picture

Status: Closed (fixed) » Active

Hi Geoff and Rooey,

Sorry for going quiet. I must also appologies as the version of DBFM is 5.x-3.3. I checked this in dbfm.info.

I have not specificed a my.cnf file (I am using MySQL provided by my hosting company), but by using phpMyAdmin I was able to find the following settings. It seems as though it is the bulk_insert_buffer_size value which has been exeeded, as this number matches the size in the error message.

Can you see anything obvious in these MySQL settings?

Variable Session value / Global value

back log 50 
basedir / 
binlog cache size 32,768 
bulk insert buffer size 8,388,608 
character set client utf8 
(Global value) latin1 
character set connection utf8 
(Global value) latin1 
character set database latin1 
character set results utf8 
(Global value) latin1 
character set server latin1 
character set system utf8 
character sets dir /usr/share/mysql/charsets/ 
collation connection utf8_unicode_ci 
(Global value) latin1_swedish_ci 
collation database latin1_swedish_ci 
collation server latin1_swedish_ci 
concurrent insert ON 
connect timeout 15 
datadir /var/lib/mysql/ 
date format %Y-%m-%d 
datetime format %Y-%m-%d %H:%i:%s 
default week format 0 
delay key write ON 
delayed insert limit 100 
delayed insert timeout 300 
delayed queue size 1,000 
expire logs days 0 
flush OFF 
flush time 0 
ft boolean syntax + -><()~*:""&| 
ft max word len 84 
ft min word len 2 
ft query expansion limit 20 
ft stopword file (built-in) 
group concat max len 1,024 
have archive NO 
have bdb NO 
have blackhole engine NO 
have compress YES 
have crypt YES 
have csv NO 
have example engine NO 
have geometry YES 
have innodb DISABLED 
have isam NO 
have merge engine YES 
have ndbcluster NO 
have openssl NO 
have query cache YES 
have raid NO 
have rtree keys YES 
have symlink YES 
init connect  
init file  
init slave  
innodb additional mem pool size 1,048,576 
innodb autoextend increment 8 
innodb buffer pool awe mem mb 0 
innodb buffer pool size 8,388,608 
innodb data file path  
innodb data home dir  
innodb fast shutdown ON 
innodb file io threads 4 
innodb file per table OFF 
innodb flush log at trx commit 1 
innodb flush method  
innodb force recovery 0 
innodb lock wait timeout 50 
innodb locks unsafe for binlog OFF 
innodb log arch dir  
innodb log archive OFF 
innodb log buffer size 1,048,576 
innodb log file size 5,242,880 
innodb log files in group 2 
innodb log group home dir  
innodb max dirty pages pct 90 
innodb max purge lag 0 
innodb mirrored log groups 1 
innodb open files 300 
innodb table locks ON 
innodb thread concurrency 8 
interactive timeout 15 
join buffer size 1,044,480 
key buffer size 157,286,400 
key cache age threshold 300 
key cache block size 1,024 
key cache division limit 100 
language /usr/share/mysql/english/ 
large files support ON 
lc time names en_US 
license GPL 
local infile ON 
locked in memory OFF 
log OFF 
log bin OFF 
log error  
log slave updates OFF 
log slow queries OFF 
log update OFF 
log warnings 1 
long query time 10 
low priority updates OFF 
lower case file system OFF 
lower case table names 0 
max allowed packet 16,776,192 
max binlog cache size 4,294,967,295 
max binlog size 1,073,741,824 
max connect errors 10 
max connections 350 
max delayed threads 20 
max error count 64 
max heap table size 16,777,216 
max insert delayed threads 20 
max join size 4,294,967,295 
max length for sort data 1,024 
max prepared stmt count 16,382 
max relay log size 0 
max seeks for key 4,294,967,295 
max sort length 1,024 
max tmp tables 32 
max user connections 25 
max write lock count 4,294,967,295 
myisam data pointer size 4 
myisam max extra sort file size 2,147,483,648 
myisam max sort file size 2,147,483,647 
myisam recover options OFF 
myisam repair threads 1 
myisam sort buffer size 67,108,864 
myisam stats method nulls_unequal 
net buffer length 16,384 
net read timeout 30 
net retry count 10 
net write timeout 60 
new OFF 
old passwords OFF 
open files limit 3,360 
port 3,306 
preload buffer size 32,768 
prepared stmt count 0 
protocol version 10 
query alloc block size 8,192 
query cache limit 2,097,152 
query cache min res unit 4,096 
query cache size 47,185,920 
query cache type ON 
query cache wlock invalidate OFF 
query prealloc size 8,192 
range alloc block size 2,048 
read buffer size 1,044,480 
read only OFF 
read rnd buffer size 262,144 
relay log purge ON 
relay log space limit 0 
rpl recovery rank 0 
secure auth OFF 
server id 0 
skip external locking ON 
skip networking OFF 
skip show database OFF 
slave net timeout 3,600 
slave transaction retries 0 
slow launch time 2 
socket /var/lib/mysql/mysql.sock 
sort buffer size 1,048,568 
sql mode  
sql notes ON 
sql warnings ON 
storage engine MyISAM 
sync binlog 0 
sync frm ON 
sync replication 0 
sync replication slave id 0 
sync replication timeout 0 
system time zone GMT 
table cache 1,500 
table type MyISAM 
thread cache size 128 
thread stack 196,608 
time format %H:%i:%s 
time zone SYSTEM 
tmp table size 33,554,432 
transaction alloc block size 8,192 
transaction prealloc size 4,096 
tx isolation REPEATABLE-READ 
version 4.1.22-standard 
version comment MySQL Community Edition - Standard (GPL) 
version compile machine i686 
version compile os pc-linux-gnu 
wait timeout 15 
geoff_eagles’s picture

That's confusing. A small file such as yours shouldn't be blocked by the settings you're using. Are you using myISAM tables?
The only setting I'd be inclined to change would be to increase the max allowed packet size.

geoff_eagles’s picture

Given the information above I don't think it's a mySQL limitation.
More likely it's your PHP settings although it might also be an apache limitation.
You might find you have more than one php.ini file on your machine e.g one under the php directory and one within the apache directory. Make sure you're editing the active one!.... that's assuming your hosting provider gives you access to such things - otherwise you're buggered.

vegemite4me’s picture

Status: Active » Fixed

I added the following line to .htaccess, and the issue now seems resolved.

php_value memory_limit 32M

It was exactly what rooey said it was, but it took me a while to realise I could change it.

Thank you for your help!

geoff_eagles’s picture

Status: Fixed » Closed (fixed)

Glad it's fixed - extra brownie points to Rooey!