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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

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

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

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


Go to End


5 Posts   5585 Views

Avatar
xcommum

Community Member, 10 Posts

11 March 2009 at 3:48am

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

Community Member, 607 Posts

11 March 2009 at 8:51am

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

php_value memory_limit 64M

Avatar
xcommum

Community Member, 10 Posts

25 March 2009 at 6:55am

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

Community Member, 150 Posts

17 May 2009 at 8:38am

Edited: 21/05/2009 12:00am

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

Community Member, 150 Posts

20 May 2009 at 11:58pm

Edited: 21/05/2009 12:24am

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?