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, Ed, biapar, Willr, Ingo, swaiba

PHP Memory Limit error preventing me from logging in

Go to End

3 Posts   3046 Views


Community Member, 19 Posts

3 March 2011 at 9:39pm

Edited: 03/03/2011 9:43pm

Hi All,

I'm having a problem with my PHP memory limit. When trying to go to the admin login page, I get this error:

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 491520 bytes) in /home/meltscom/public_html/silverstripe-cache/.cache.home.meltscom.public_html.sapphire.template on line 622

I have tried changing php.ini to memory_limit = 256M manually, but it doesn't help. What else can I do to up the limit to prevent this from happening?

I've also tried changing max_execution_time to 1000. I have also found and corrected ini_set('memory_limit', '256M'); in sapphire/_config.php, and added the same line to mysite/_config.php.

Edit: I have run phpinfo, which confirms the memory limit is set to I'm very stuck now :(

Edit: I found in another thread a suggestion to add php_value memory_limit 256M to the .htaccess file, I was just wondering where to add it because adding that exact line at the bottom of the .htaccess file in the root folder causes an Internal Server Error for the entire site (not just the admin page as the original error did).


Forum Moderator, 1899 Posts

4 March 2011 at 1:39am

Edited: 04/03/2011 3:06am


I'd do the normal debugging stuff and find out what it is that is causing the issue...

I have this recently with an image that on upload went from 1.3MB to 13MB and it was then being scalled down - I could see the GD section of code and filename and could then manually change the image. So you should be able to find something that indicates the issue and you can make a db/code/asset change to fix...


Community Member, 19 Posts

27 July 2011 at 11:09am

Hi all,
I had someone contact me about this post because they were having the same issue, so I thought I would post the solution here for the benefit of anyone else who needs it.

It was a friend of mine who found the solution to this one. In the home directory you should have a php.ini file (or if not, create one - contact your host if you don't know how to do it, mine has a tool that generates it). Then increase the memory limit setting to 128M or higher.

This alone however may not solve it. What solved it for me, as my friend worked out, is to put a copy of the php.ini file inside the sapphire directory as well as in the home directory. I honestly don't know why this works, maybe sapphire accesses something else by default and this overrides it, I don't know, but this worked for me.

Hope this is helpful!