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

Exhausted Memory


Go to End


6 Posts   1388 Views

Avatar
animasola

Community Member, 121 Posts

3 November 2009 at 2:30am

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! :)

Avatar
Mo

Community Member, 541 Posts

3 November 2009 at 3:13am

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

Avatar
animasola

Community Member, 121 Posts

3 November 2009 at 4:26am

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!

Avatar
Mo

Community Member, 541 Posts

3 November 2009 at 7:27am

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

Avatar
animasola

Community Member, 121 Posts

3 November 2009 at 9:15am

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. :)

Avatar
Mo

Community Member, 541 Posts

3 November 2009 at 9:29am

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