PDA

View Full Version : "Allowed memory size exhausted" on UPLOAD TO DATAB


cords
26th of February 2004 (Thu), 13:53
hi all!

i installed EE v1.5b RC2 today - after being a user of v1.22 for some time. i started with a clean install (new path and database) and while a little slow to do, it was a relatively painless process. i am really impressed with v1.5 so far.

i created a new exhibition and ftp'ed a couple test files to the input/UPLOAD/ directory. then i went to the UPLOAD TO DATABASE editor, selected a file and a resize path and clicked UPLOAD. EE choked with the following error:

Fatal error: Allowed memory size of 8388608 bytes exhausted at (null):0 (tried to allocate 6400 bytes) in /home/fhlinux195/m/memescape.co.uk/user/htdocs/gallery/input/RESIZE_gd.php on line 44

any ideas what's happening and why? the ftp server and graphic modules all appear to have been set up correctly and other php-based scripts installed on the server run fine - including a wiki. i'm using a hosted solution from FastHost.co.uk and the EE server information is as follows:

Server signature:
Server name: memescape.co.uk
Server protocol: HTTP/1.1
Http accept: text/html, application/xml;q=0.9, application/xhtml+xml;q=0.9, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1
Http accept encoding: deflate, gzip, x-gzip, identity, *;q=0
MySQL version (reported by MySQL server): 4.0.18-standard
PHP version: 4.3.2
Database in use: memescape

any help or advice will be greatly appreciated!

kind regards,
cord schneider

Pekka
26th of February 2004 (Thu), 15:08
Technically speaking: The PHP ran out of max memory when GD tried to create resource of your original image.

PHP has a setting which defines what is maximum RAM size it is allowed to use. Mostly it is 8MB by default. This may not be enough if you have a big JPG as it is opened into memory - a 4MB JPG can easily be 20MB in RAM.

One method a suggesting PHP a larger memory limit is to add

ini_set ("memory_limit",128M);

in the code - you can place it in SCRIPT_editor_functions.php on second line

Other method is to add to your .htaccess file (create one on your input folder if there is none, note the '.') a line:

php_value memory_limit 128M

Those settings does not mean PHP will always use 128MB or RAM, it uses as much as is needed at a time.

If either of above methods don't seem to help them you simply must use smaller originals for uploading.

cords
27th of February 2004 (Fri), 03:12
hi Pekka,

thanks for the very prompt response. i am really amazed at the speed at which problems get addressed in this forum; the support for EE is amazing!

here's my feeback for other users who may (or may yet) have the same problem. i'll start with the second solution first as it was the one that i tried first. i figured that this fix would have the lowest impact in regard to future updates to EE.

Other method is to add to your .htaccess file (create one on your input folder if there is none, note the '.') a line:

php_value memory_limit 128M

it seems that php either ignored the contents of .htaccess, or appache didn't pass them through. either way, this didn't work for me and i still got the same error.

One method a suggesting PHP a larger memory limit is to add

ini_set ("memory_limit",128M);

in the code - you can place it in SCRIPT_editor_functions.php on second line

this solution worked like a charm except that initially i received a parse error from php. the actual syntax requires quotes around the second parameter like so:

ini_set ("memory_limit","128M");

perhaps this should be added to future releases of EE since i am assuming that most hosted solutions will probably have a default 8M limit?

If either of above methods don't seem to help them you simply must use smaller originals for uploading.

heh heh.. the irony is that the file i was trying to upload was only 1K bigger than the sample source.jpg that is used to configure the graphics modules. it seems that it must have just snuck over the threshold.

kind regards,
cord schneider