[prog] Freeing memory in PHP/Apache

Rasjid Wilcox rasjidw at openminddev.net
Sat May 1 11:20:14 EST 2004


I am using a PHP based CMS (MySource by Squiz.net) and although quite good it 
is a little heavy handed with the memory usage.

Upon starting apache, each child uses about 3MB of memory.  However after 
serving up a page through MySource, the memory usage of the child concerned 
jumps to about 12MB and stays there.  (Actually, I get two such instances.)  
Since this is a User-Mode-Linux based virtual server, I only have 96MB ram, 
and so this was quite a problem.

My workaround was to set the apache MaxRequestsPerChild to 1, so each apache 
child serves up one page and then dies, and releases the memory.  This works, 
but adds the overhead of apache children constantly being killed and being 
respawned.

Is there a better way to deal with this?  I know very little PHP, and could 
not find any obvious command to tell php to release unused memory.

I am running Apache 1.3.26 and PHP 4.3.5 on Debian Woody (with some 
backports).

Cheers,

Rasjid.



More information about the Programming mailing list