Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+9 votes
1.8k views
in Plugins by
Hi, I have downloaded the latest version of Q2A & the badges plugin (amongs others). However, the badges plugin causes a "allowed memory size exhausted" fatal error. I have tried do increase memory size up to 192M, however, still not enough. It is installed on a "clean" forum - 2 users, 1 question, so it can't be caused by large recalculation of an existing database. This error is only thrown in the admin -> plugins section. Everything else (incl admin sections) seems to work as expected. However - the badges initialization did not make any changes yet (as it's ending prematurely), so badges don't work... Any ideas?
Q2A version: latest as of 17/11/2012
by
Same issue here.
by
in the meaintime, this issue has caused me to drop Q2A and go for a custom self-programmed solution...
by
Same problem.

Error:
PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 12956 bytes) in [snip]\qa-plugin\q2a-badges-master\qa-badge-admin.php on line 17

Line 17 of qa-badge-admin.php:
$slug = preg_replace('/badge_(.+)_[^_]+/',"$1",$option);

My only guess at this point is that this regex operation is resulting in an huge number of matches to replace resulting in the memory issue.

2 Answers

–1 vote
by
I got the same issue, hopefully someone will figure out what the issue!?
by
upvote the question please to indicate it's important
+4 votes
by
edited by

This is what I just did and seems to work.

On the file README.rst on line 40 it says:

#. navigate to your site and check your database to make sure the ^userbadges table was created

There was no table there, and the memory error was preventing the plugin to create the table.

PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 12956 bytes) in [snip]\qa-plugin\q2a-badges-master\qa-badge-admin.php on line 17

So I commented out the line 17 on qa-badge-admin.php like this:

//$slug = preg_replace('/badge_(.+)_[^_]+/',"$1",$option);

And then went to www.mysite/admin/plugins, then I checked and the table was created, after that I removed the comment from the line like this:

$slug = preg_replace('/badge_(.+)_[^_]+/',"$1",$option);

And it is working now.

Hope this helps others with the same problem.

Edit:

If you use this procedure to activate the plugin, please read this other question:

http://www.question2answer.org/qa/20531/is-this-ok-on-the-admin-section-of-q2a-badges-plugin

by
This is what you actually should do with ALL plugins after uploading them to your server: Go to >Admin >Plugins and check if it is there. q2a plugins do create db-tables only when accessing this admin site!
by
Thanks for your comment
The thing was that every time I went to Admin>Plugins, I got the memory error:
PHP Fatal error:  Allowed memory size of XXXX bytes exhausted (tried to allocate XXX bytes) in [snip]\qa-plugin\q2a-badges-master\qa-badge-admin.php on line 17
And the table was never created.
by
This worked perfectly for me, thank you so much!
...