Upload results in fatal error

8 posts by 3 authors in: Forums > CMS Builder
Last Post: March 26, 2008   (RSS)

By jsv - March 21, 2008 - edited: March 21, 2008

When uploading files with CMS, after a while I receive this error message:

"Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 2816 bytes) in /public_html/cmsAdmin/lib/menus/default/uploadForm_functions.php on line 230"

The picture size was 1,5 Mb. When uploading smaller pictures I don't receive errors. However, in CMS I have set the maximum size "unlimited" and within PHP the maximumupload size is set to 16M. Can you please advice me what to do?

Jan

Re: [jsv] Upload results in fatal error

By Dave - March 21, 2008

My first guess would be that the automatic image resizing and thumbnailing takes a lot of memory. Although, that really does seem like a _lot_ of memory to be using. You could confirm that by temporarily disabling "Resize images larger than..." and "Create Image Thumbnails..." and trying again (then turn those back on).

There is a 'memory_limit' setting that you can sometimes set through your own php.ini or .htaccess, but other than that you'd have to ask your host if they can increase the limit.

Also, if it turns out that CMS Builder is using more memory than regular PHP programs to resize images I can look into that as well.

Hope that helps, let me know what happens.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Upload results in fatal error

By jsv - March 21, 2008 - edited: March 21, 2008

Hi Dave,

If I turn off resizing, the images are uploaded without any errors.

After upgrading to version 1.12, and after turning on resizing again, I still receive errors:

Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 2816 bytes) in /home/wwwhulp.nl/public_html/cmsAdmin/lib/menus/default/uploadForm_functions.php on line 238


?

Jan

Re: [jsv] Upload results in fatal error

By jsv - March 22, 2008

The 'memory_limit' is 16M, that should not be the problem?

Is there anything else I can check and change to improve the upload proces?

Re: [jsv] Upload results in fatal error

By MikeB - March 24, 2008

Hi Jan,

Thanks for the post!

I'm curious if you're using any other PHP scripts on the server to upload images.

If not, it may be helpful if you can get in touch with your host and see if they can provide any example or test PHP scripts that will resize images. This way we can see how this is working external to CMS Builder and troubleshoot the issue from there.

I look forward to hearing from you Jan! [:)]
Cheers,
Mike Briggs - Product Specialist
support@interactivetools.com

<hr /><i><a href="http://www.interactivetools.com/consulting/" rel="nofollow"><b>Hire me!</b></a>
Save time by getting our experts to help with your project. Template changes, advanced features, full integration, whatever you need. Whether you need one hour or fifty, get it done fast with <a href="http://www.interactivetools.com/consulting/" rel="nofollow"><b>Priority Consulting</b></a>.</i>

Re: [jsv] Upload results in fatal error

By Dave - March 25, 2008

Hi jsv,

The short term fix is to limit the size of uploads that are accepted (forcing users resize them first - if possible) or ask your host to increase your memory limit for PHP. You can let them know you're running out of memory resizing uploaded images.

I've been doing some research and reading the comments over on PHP.net about image resizing (link) and it looks like resizing larger files just takes a lot of memory. Do you have any other image resizing applications on your server that can resize the image file?

I have some ideas on some programming tricks we might be able to use to reduce to memory usage. Could you send me a copy of the image file you get the error with? So I can reproduce the issue locally on my development machine? My email is dave@...

Hope that helps! Send me the file and I'll see what I can do to reduce memory usage. And in the meantime check with your host about increasing PHP's memory limit.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Upload results in fatal error

By jsv - March 26, 2008

Hi Dave,

I didn't want to get into long complex calls with my provider (I'm satisfied with their support but it is not comparable with the support you guys provide me!). I have found some tips on:

http://www.ducea.com/2008/02/14/increase-php-memory-limit/

And I have added

[font "Courier New"]ini_set('memory_limit', '64M');[/#0000a0]

in "uploadForm_functions.php". That solved the problem.

My next questions are:

- in which other files should I add this line?
- can you advise me which value should be set (64M?)

The images I have tested were normal jpg's, with a maximum size of 3mb

Best regards,

Jan