PHP Fatal error: Out of memory (allocated 28311552)

Ash Nallawalla

7 January 2012


While checking out the TrainSEM website, which runs aMember software, I got a PHP error instead of the usual page:

Fatal error: Out of memory (allocated 28311552) (tried to allocate 40961 bytes) in /home/trainsem/public_html/amember/library/Am/abc.php on line 343

I checked aMember Setup > Configuration, and got:

I doubled the VPS memory_limit to 64M in php.ini (via WHM) and rebooted but the above errors did not go away.

After reading a few threads on different forums, I solved it.

Probable Cause

The likely cause of the error started a few days ago, when I was in WHM > Apache Configuration, which has a feature called Memory Usage Restrictions. Unlike other tools in WHM, this one just goes ahead and changes the RLimitMEM value based on previous usage. In my case, the value (in httpd.conf) was 55924053.

After reading about my error in other forums, I saw a lot of advice to increase the value of memory_limit in php.ini, including one example upping it to 999M! Luckily I saw other comments suggesting that this isn’t the way to tame scripts with memory leaks and to also check Apache’s httpd.conf for the RLimitMEM value.


If you have root access (VPS or dedicated server), look for this value by typing at an SSH prompt:

grep -i rlimit /usr/local/apache/conf/httpd.conf

If there is a value, e.g. RLimitMEM 55924053, comment it out with “# ” and restart Apache.

This fixed my problem and might help others. Be sure to backup php.ini before you try this.

Ash Nallawalla

Search strategist experienced in large, complex websites. Ash's Google+ profile

Related Posts

Photos from 14-15 August 1947 – Indian Transfer of Power ceremonies

Ash Nallawalla

28 July 2013


Feel free to share...My uncle, Jayantilal B. Nallawalla was commissioned by Lord Mountbatten to be his private photographer a few months before and during the Indian independence day (“Transfer of Power”) ceremonies. For the first time, his photos are being released online. As a teenager, I was privileged to communicate with Lord Mountbatten for several […]

Read More

CAPTCHA for aliens

Ash Nallawalla

15 March 2011


Feel free to share...The CAPTCHA project is a worthy initiative from the Carnegie Mellon University and is commonly found on forms to reduce bot spam and exploits. I was reading an article at NAB’s Money Basics site and happened to notice the CAPTCHA text below the comment form: Feel free to share...

Read More

Older Posts