— 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.
Asked
Active
Viewed 4,358 times
3
poige
- 9,730
- 3
- 28
- 53
3 Answers
3
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.
Michael Hampton
- 252,907
1
The ulimit shell feature (which uses the setrlimit system feature) can limit per-process memory use.
On a Debian box, this can be done by adding this to the bottom of
/etc/default/apache2:
ulimit -v 1048576
http://feeding.cloud.geek.nz/posts/putting-limit-on-apache-and-php-memory/
See also
- man ulimit
- man setrlimit
tomclegg
- 301
-2
I deem it should be considered answered with exactly this quote from the comments: "There isn't one (solution). It depends entirely on the modules you are using" © Michael Hampton
poige
- 9,730
- 3
- 28
- 53