How to limit Apache sub-process memory usage?

poige asked:

— Yeah, just that simple question. It’s too easy to consume a lot of RAM in brain-dead mod_XxX (say, mod_php) application, so I’m just wondering what does Apache allow to do as countermeasure.

My answer:


Apache doesn’t, but PHP does allow limiting the maximum amount of memory used, in php.ini. For instance:

memory_limit = 128M

Of course if someone hits this limit the actual amount of RAM used will be slightly higher due to PHP being embedded into Apache.


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.