Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

On CentOS 5.8/Apache 2.2.3/FastCGI/PHP 5.3.10 virtual machine I have the original and a cloned Magento install (to be used as a staging server). I would like to minimize memory usage by apache and php on this staging server ONLY and I'm looking for recommendations on how to do this.

For example, I want to know if its possible to set limits like prefork MPM/worker MPM on a single virtual server.

PHP memory_limit is already set to 128M, as that is the minimum Magento needs to run.


share|improve this question

migrated from Apr 18 '12 at 17:24

This question came from our site for professional and enthusiast programmers.

You might reduce the memory usage by swithcing from Apache to nginx. – pkhamre Apr 18 '12 at 17:28
One method may be to run two copies of apache/fastcgi. Allowing you to reduce the min servers and spare servers for the staging environment ( plus tweaks to fastcgi ). – becomingwisest Apr 18 '12 at 17:34
up vote 2 down vote accepted

Your memory limits need to be the same on your development/staging environment as on your live site - otherwise a script which works on one, will not work on another.

So reducing any memory allocations would not be wise.

If you are using the same server for both development and production stores - separation via VPS seems a little peculiar (if you are trying to keep memory overheads to a minimum) as you will encourage additional RAM usage simply to run a duplicate of every service?

It would make more sense to run your staging site on the same VPS as your production store, running the PHP instance as another user that has specific limits set in /etc/security/limits.conf - then you can prevent runaway memory usage, number of processes and anything else.

If you truly need resource and platform separation (ie. for PCI DSS compliance or even just best practice), then in your staging/dev VPS, simply set a maximum of 1 Apache thread. If you are the sole developer, there will only need to be one process/spawn running.

But ultimately

RAM is exceptionally cheap - just buy more. Don't constrain your application or try to run twice as much with half what you should have.

share|improve this answer
I am running the staging site on the same VPS as your production store, but eventually I want to run it on a duplicate VPS. That is the only way I can test LAMP stack upgrades without damaging the production store. I will check into /etc/security/limits.conf for now. Thanks! – Gaia Apr 24 '12 at 20:04
In that case, just wait until you've got another VPS - they are cheap enough :) – Ben Lessani - Sonassi Apr 25 '12 at 14:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.