Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

How to Change Memory Limit for Fatal error: Allowed memory size


Reply

5 Posts   3330 Views

Avatar
xcommum

11 March 2009 at 3:48am Community Member, 10 Posts

I am having problems uploading a 1MB file of contacts (CSV) to a newsletter mailing list, however I always get an error during upload, error is: Fatal error: Allowed memory size of x bytes exhausted (tried to allocate 49 bytes) in /cms/code/Newsletter/RecipientImportField.php on line 151

I tried adding 'ini_set('memory_limit', '64M');' to /sapphire/main.php but this did not help. Any ideas??

Avatar
Double-A-Ron

11 March 2009 at 8:51am Community Member, 604 Posts

Wierd error for a 1MB file, but try setting the memory limit in .htaccess instead:

php_value memory_limit 64M

Avatar
xcommum

25 March 2009 at 6:55am Community Member, 10 Posts

Thanks for the tip, tried that as well, but with no luck.. I had to use another newsletter system instead to be able to handle the contact load list. Other systems seem to have no trouble with it.. (ie. PHPlist)

Avatar
klikhier

17 May 2009 at 8:38am (Last edited: 21 May 2009 12:00am), Community Member, 150 Posts

I have a similar same issue. Client uploaded 3 large images (around 2MB each) in the 'Uploads' folder by using the 'Files & Images' tab. When clicking the 'edit' icon behind these images in the 'Files & Images' section OR when selecting the 'Uploads' folder when adding image to TinyMCE HTMLEditorField the following error message occurs:
<br >
<br >Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 26000 bytes) in /home/domains/mywebsite.com/public_html/sapphire/filesystem/GD.php on line 24
<br >
<br >Adding 'php_value memory_limit 64M' to .htaccess file (or even 'php_value memory_limit 128M') did not change anything. phpinfo() tells me the memory limit is 128M.
<br >
<br >Please help, many thanks in advance.

Avatar
klikhier

20 May 2009 at 11:58pm (Last edited: 21 May 2009 12:24am), Community Member, 150 Posts

After some more investigation this is not related to file size, but to file dimensions (in this case the abnormal 6500px width). Is there something we can do to either resize the image after upload in the 'Files & Images' or disallow images with dimensions larger than xxx pixels?