Search code examples
phpapachememory-leakselgg

Locating a cross-server memory leak


I have a social network based on elgg open source platform (PHP) and I've been having some memory related problems with it.

Fatal error: Allowed memory size of 12582912 bytes exhausted (tried to allocate 23456789 bytes) in somefile.php

My web application architecture contains 2 apache web servers (linux) with a load balancer between them. about 3-4 times a day the web application collapses and it takes about 2-3 mins for it to go back up again by its own. Knowingly this is just a patch (an ugly one as well) I upgraded the memory on both of the servers and I updated the php.ini to memory_limit = 512M. I know i still need to locate the memory leak but i just wanted to see how bad was it, and to see if it actually helps.

My real question is: since i have two web servers running the code, how come the entire application collapse and not just one of the servers each time?

Thanks in advance, Itay


Solution

  • In this case the problem was that the settings in the .htaccess file were overriding the php.ini.

    I figured it out thanks to Pawel Sroka's comment.