Upload results in fatal error

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

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

Re: [jsv] Upload results in fatal error

By Dave - March 26, 2008

That's great that that fixed it.

Resizing images is what is going to take the most memory so adding it to uploadForm_functions.php is probably good enough. If you get errors again you can add it to /lib/init.php and that will make sure it gets called everywhere.

I've added it to /lib/init.php for the next version with a value of 128M. So long as you aren't getting any memory limit errors, 64M should be fine though.

Let me know if you have any other questions.
Dave Edis - Senior Developer
interactivetools.com