 |

jsv
User
Mar 21, 2008, 3:22 AM
Post #1 of 8
(715 views)
Shortcut
|
|
Upload results in fatal error
|
Can't Post
|
|
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
(This post was edited by jsv on Mar 21, 2008, 3:27 AM)
|
|
|  |
 |

Dave
Staff
/ Moderator

Mar 21, 2008, 9:40 AM
Post #2 of 8
(710 views)
Shortcut
|
|
Re: [jsv] Upload results in fatal error
[In reply to]
|
Can't Post
|
|
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
|
|
|  |
 |

jsv
User
Mar 21, 2008, 4:12 PM
Post #3 of 8
(697 views)
Shortcut
|
|
Re: [Dave] Upload results in fatal error
[In reply to]
|
Can't Post
|
|
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
(This post was edited by jsv on Mar 21, 2008, 4:16 PM)
|
|
|  |
 |

jsv
User
Mar 22, 2008, 4:28 AM
Post #4 of 8
(668 views)
Shortcut
|
|
Re: [jsv] Upload results in fatal error
[In reply to]
|
Can't Post
|
|
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?
|
|
|  |
 |

MikeB
Staff
/ Moderator

Mar 24, 2008, 4:25 PM
Post #5 of 8
(627 views)
Shortcut
|
|
Re: [jsv] Upload results in fatal error
[In reply to]
|
Can't Post
|
|
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
Hire me! 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 Priority Consulting.
|
|
|  |
 |

Dave
Staff
/ Moderator

Mar 25, 2008, 12:17 AM
Post #6 of 8
(621 views)
Shortcut
|
|
Re: [jsv] Upload results in fatal error
[In reply to]
|
Can't Post
|
|
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
|
|
|  |
 |

jsv
User
Mar 26, 2008, 3:18 PM
Post #7 of 8
(595 views)
Shortcut
|
|
Re: [Dave] Upload results in fatal error
[In reply to]
|
Can't Post
|
|
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 ini_set('memory_limit', '64M'); 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
|
|
|  |
 |

Dave
Staff
/ Moderator

Mar 26, 2008, 3:29 PM
Post #8 of 8
(591 views)
Shortcut
|
|
Re: [jsv] Upload results in fatal error
[In reply to]
|
Can't Post
|
|
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
|
|
|  |
|