So, neither I nor my colleague can find an answer to our question. HOW do we limit PHP’s total memory usage on apache?
We are running CakePHP 2.x on an EC2 instance on AWS, the instance has 15GB of memory. I know that in the php.ini file there is a memory_limit={GB/MB} that according to the PHP docs limits the amount of memory any single script can use. So how do we enable this same type of limit on PHP as a whole? We are running PHP v5.4 on Apache 2.4. Any help would be greatly appreciated!
2
Answers
Ohh i see. You can’t do that with php language. You would have to limit the apache server memory. As well i don’t thats possible. But you can optimize your server cpu usage (number of processes and threads) and use the php.ini
memory_limit = 128M
which will limit memory usage per process.You can edit your confextrahttpd-mpm.conf and manage it:
Hope it helps
It depends majorly on you logic, if there is a specific code block where you need to assign more memory to process.
There are 2 ways.