Jump to:

23376 Posts in 18218 Topics by 2867 members

General Questions

SilverStripe Forums » General Questions » Exhausted Memory

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

Page: 1
Go to End
Author Topic: 960 Views
  • animasola
    Avatar
    Community Member
    121 Posts

    Exhausted Memory Link to this post

    Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 335 bytes) in /home/lexdraft/public_html/sapphire/core/HTTP.php on line 263

    I got that error for my site. As far as I know, I allocated 64M of memory through a php.ini file and it reflected in the phpinfo() function call. Any remedies? I need to get it back up as soon as possible.

    Any piece of advice would be highly appreciated. Thanks!

  • Mo
    Avatar
    Community Member
    505 Posts

    Re: Exhausted Memory Link to this post

    I got a similar issue not to long ago, it turned out to be about 130,000 spam comments in my database. Might be something similar?

    Mo

  • animasola
    Avatar
    Community Member
    121 Posts

    Re: Exhausted Memory Link to this post

    Oh, how did you delete those comments? Actually, I've been receiving tons of spam but I designated other people to take care of it. I guess they didn't do their job coz last time I checked, it had heaps of spam.

    How did you delete them? Are there other remedies? Like temporarily accessing the comments section to delete them?

    Thanks!

  • Mo
    Avatar
    Community Member
    505 Posts

    Re: Exhausted Memory Link to this post

    Can you not access the admin area? I am not saying that this s defiantly your issue. I could still access the admin area when I had the spam issue.

    If you cant, then it sounds like it may be a bigger problem. How did this error start? Was it after you added some new code? If so, it could be something stuck in an infinate loop.

    If it is comment spam, and you can't access the admin, you will probably have to access the database directly (Something like PHPMYADMIN) and check the PageComment table. You will be able to see from there if there are a lot of spam comments. If there is a lot of spam, you will also need to delete the comments through this system.

    Have you tried doing a /dev/build/?flush=all Maybe clearing your template cache would help.

    Have you checked your servers error logs? They may be able to shed a bit more light on the problem.

    You can also add basic spam protection to comments by using adding:

    MathSpamProtection::setEnabled();

    To your _config.php file. I have found this simple field has cut pretty much all out spam comments out.

    Finally, what version of SIlverstripe are you using? Have you got any modules installed? Are you running this on your own server, or a shared host?

    Hope that's of some help.

    Cheers,

    Mo

  • animasola
    Avatar
    Community Member
    121 Posts

    Re: Exhausted Memory Link to this post

    Thanks heaps for all the tips you just gave. I accessed the admin area and damn, I've got over 21,000 spam comments. I don't know how to delete all of them.

    How do you set comments to be moderated before being approved?

    Well, as a last resort, I deleted them through an SQL statement. There were just too much to go through all of them. I used this:

    DELETE FROM PageComment WHERE ID>500

    Thanks a lot Mo! It's now back online.

  • Mo
    Avatar
    Community Member
    505 Posts

    Re: Exhausted Memory Link to this post

    21,000 is not as bad as it could be. Luckily I knew there were only a few legit comments, so I found those, backed them up then dropped the PageComment table. Then recreated it with the original entries. all that had to be done via SQL unfortunately .

    As for moderation and spam protection, look at this page: http://doc.silverstripe.org/doku.php?id=configuration&s=comment%20moderation

    It has some useful configuration options.

    PageComment::enableModeration();

    That will set comments to appear on a page, only after moderation, but spam comments will still appear in the database. Ti reduce the number of spam comments you get, you should at least use:

    MathSpamProtection::setEnabled();

    This will add a basic maths question to your comment form, that will stop the form being submitted if it is incorrect. It works pretty well against a lot of spam bots.

    I would recommend adding both to your _config.php file .

    Mo

    960 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.