Sometimes your php.ini file says one thing, but reality demonstrates something different. What can you do when your hosting company comes back to you with a reply like: "your php.ini memory limit is set to 128M" even though you have seen the dreadful "Fatal error: Allowed memory size of XXXXXXX bytes exhausted..." when trying to load your website page. Well, read on to see how you can debug things on your own, and how to use your findings to reply to your hosting company's support team. First of all, you should know that when you get an error message like:
Fatal error: Allowed memory size of 25165824 bytes exhausted (tried to allocate 71 bytes) |
it typically means that you are not able to allocate more than 24M (this is 1024 x 1024 x 24 = 25165824) bytes worth of memory — no matter what your hoster tells you, or what your php.ini files states, or what your Joomla System info php information tab states.
First thing you should check is your PHP Information tab of your Joomla System Info menu as described in the Checking your PHP settings tutorial. You need to search for the ‘memory_limit’ parameter.
The example shown in this figure states that the PHP memory in this Joomla! website environment is set to 64M. But how can we verify this?
I have coded a simple php script to brute force test memory allocations. Just download the following package, unzip it and upload the phpmemtest.php script to your hosting environment. If you upload it to your html public folder then execute it by accessing the URL http://www.yourdomain.com/phpmemtest.php — you should see some output like the following figure.
So, according to this script, it looks like only 48M are available in this environment and something is prohibiting our script to reach the 64M allocation limit that the PHP Information tab is claiming. This information — the script and its output — should be sufficient to present to your host support team to document your claim.
Having responded to many forum requests on Joomlapolis regarding exhausted memory we have created a FAQ article describing basic steps to debug such situations. This FAQ article can be read here. Notice how the community has responded and contributed the Apache setting.
Hopefully, this article will help those confronted with memory issues.