Memory_limit problem in Joomla with Community Builder

Check out my new website where I am now maintaining all my blogs.
Thank you.
Marco Conti

Working with Joomla! is very exhilarating and there is a tendency, when you work on your site, to want to test all the different modules available. Some of them have some really crappy code, others are simply not compatible with one of the other modules. Inevitably, problems will arise. I had almost finished building my site,  when it crashed big time. At that point I decided to install it again from scratch making sure to document and back up every step of the way, a practice I follow religiously when I work for a client but that I sometime ignore when working on my own site. Big mistake.

Everything was going fine until i installed Community Builder, a great app for building communities with Joomla, and I linked it with Joomlaboard, a light weight forum that is actually quite useful and even powerful if not the prettiest out there.

I tested the site and it worked fine until I went for dinner. At my return, trying to view my profile as a user in the front end gave me this error message:

Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to
allocate 184320 bytes) /-/-/-/-/mod_filename.php

The rest of the page was a blank. I did a quick search in the various forum, starting with joomlopolis, the makers of the Community Builder script for Joomla.

There I found several mentions of this problem but no solutions. In fact, the tech guys seemed to be annoyed at us posting about this problem Their not very useful replay was “Google it“.
From there a gathered that the CB scripts exceeds PHP assigned memory allocation on a given server, and the only cure it seems is to allocate more memory in the php.ini file of the server and restart.
For users on shared servers this is simply not an option. In some cases it may be possible to ask, but more often than not you’ll get a “buy a dedicated server” answer.
What makes this problem very bad is that my site currently is in testing and only my cat, Scruffy, and I know it’s operational. If it runs out of memory with one user, can you imagine what it will do with (Gasp!) 10 or 20 users concurrently?
Eventually I searched the Joomla forum and found out a bit more, but it was while searching Google for “Fatal error: Allowed memory size of 8388608 ” that I hit pay dirt.

I found a post that suggested increasing the memory allocation in the server to 12 MB in the .htaccess file with this script:

memory_limit = 12M

When I tried it my server crashed miserably, but eventually I came across a post on the Drupal forum where they suggested to either do the same thing with the .htaccess file or to place this line

ini_set(‘memory_limit’, ’12M’);

in Drupal’s sites/default/settings.php file (here is the link to the post )
Armed with that info, I decided to try something crazy and I inserted the same line of code in configuration.php file of my Joomla installation. What did I have to lose?
I was expecting some sort of server error again, but instead I reloaded the page in my browser and clicked on the “profile” page link that was giving me the error

Allowed memory size of 8388608 bytes exhausted

and it worked like a charm. Pure magic!
Just to make sure I wasn’t hallucinating, I commented out the line and tried again : the error appeared again, so my fix was working fine.

However, I was about to encounter another problem. Joomla rewrites the configuration.php file each time it is accessed from the Cpanel. That means that my little, miraculous line of code was getting erased on a regular basis.

Fortunately, in the same post there was another small hack: entering this line

memory_limit = 32M

in the php.ini file in the root folder of the Joomla installation. When I tried that the first time, like the .htaccess file it did not work. However, just in case I could have made a mistake, I tried again. This time it worked and what’s more it’s sticking.
Apparently, this error is quite frequent and I am surprised that, at least in the Joomla arena, I seem to be the only person to come up with a workable solution. This problem, according to the Joomla forums has gone unsolved for quite some time.

Below is the post I contributed to in the Joomla forum, in case you’d like to learn more about this bug.
I hope this article will help others find a quick solution to their Joomla memory error problems, but be warned: not all shared hosting servers administrator will be happy with you if you start messing up with their memory allocation.
I do have a feeling that his little fix my even have the result of speeding up your Joomla installation a bit. after all, it increases the memory allocation for every script, not just the CB Login ones.
Always make sure to back up any file you change or you are asking for trouble.
Original Joomla forum post:
About Memory_limit and fatal errors

Good Luck and thank you again for reading this blog

Marco is a Sacramento based web designer/developer.
Marco’s company is a full service
web agency specializing
in e-commerce and Content management system development, photography, web
marketing and copy writing.


20 responses to “Memory_limit problem in Joomla with Community Builder

  1. I have been going crazy trying to figure out how to make CB work! Joomlapolis is useless, since there are never any answers to the problems brought up in the forum.

    This made my whole day, thanks.

  2. Hey, glad I could help. Soon I’ll be posting more articles and tutorials here and on my new website. I was so mad that there was so little documentation around that I decided to write an article every time I learn something new.
    Take care and come and visit me at in a few days when I am done with it.

  3. With the .htaccess file.. the entry should be:
    php_value memory_limit 32M

  4. This has been SO frustrating! Thank you for your post. I used the .htaccess file solution and all my CB problems are gone!

  5. I’m having trouble with your solution. I don’t understand what goes where. Any help?

  6. 10x.

    very helpfull

  7. Many thanks! This helped me solve a problem that came up right before launch. It had to do with the plugin for Acajoom to Community Builder.

  8. you saved my time thank you

  9. Them .htaccess files can be very powerful and they can be a pain in the funny bone.

    Good solution!

  10. Very good jobs, i kill my problem with joomla and memory put

  11. i tried .htaccess but it did not worked, however i think i wonder no one write proper steps, only write what they see at front of their monitor, if you guys have solution instant of another article so please mention it in steps to followup so that it is easy for others.

  12. Hi

    Thanks so much for posting your research on this topic here. I had to take one site down and another in development is having the same problem. I am using CB, Forums, SOBI2, adsmanager, etc. However it seems my memory usage is primarily because of CB. My hosts disable the site everytime it overuses memory. It seems to use between 34mb and 36mb of memory. I am not a techie, however my developer seems to be unable to solve this issue as well. Any assistance with this will be HUGELY appreciated. Is your allocation of 32MB working till today?

    I will really appreciate any help. PLease mail me, would love to discuss this with you. I am considering using another community script.


  13. My php5.ini file has

    memory_limit = 500M

    But still the error is occuring. It is occuring in different components, not just CB.

  14. Wow man, you saved my day!! (and my website :)) Have been searching so long for a solution and you made it happen. Thanks man, very clear explanation

  15. My relatives every time say that I am wasting my time here at web, however I know I am getting experience daily
    by reading such fastidious content.

  16. Excellent, what a website it is! This website presents useful facts to us, keep it up.

  17. Good information. Lucky me I came across your website by chance (stumbleupon).

    I have saved it for later!

  18. Wow, amazing blog layout! How long have you been blogging for?
    you made blogging look easy. The overall look of your site is great, as well as the content!

  19. Have you ever thought about creating an ebook or guest authoring on other sites?
    I have a blog based on the same ideas you discuss and
    would really like to have you share some stories/information.

    I know my subscribers would value your work. If you’re even remotely interested, feel free to shoot me an e mail.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s