“You cannot build dynamic websites until you forget most of what you learned building static sites.”
Written by Marco Conti Saturday, 28 October 2006 12:47
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:
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 lineini_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 linememory_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 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 conticreative.com a full service web agency specializing in e-commerce and Content management system development, photography, web marketing and copy writing.
|< Prev||Next >|
Conticreative offers Individual and Corporate training (in person or online) on Joomla, Wordpress, Zen Cart and other leading Open Source scripts.