Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

What's the preferred way to setup a privilege separated, shared environment with Apache2 security and performance wise? I'd like to run each virtualhost under a different user/group and handle PHP requests as fast as possible.

share|improve this question
up vote 2 down vote accepted

I'd favour FastCGI + php-fpm for this. With php-fpm you can set each pool to listen on a separate port (or socket) and define the user/group as well as additional parameters of the pool (e.g. chroot directory, php_openbasedir, servers to start, environment variables, memory limit, etc). Setup FastCGI in Apache, and use FastCGIExternalServer to point to the specific php-fpm pool you wish to use. (Create one pool per virtualhost, with the correct user/group, and other restrictions (open_basedir, chroot, etc).

(I believe the previous option would have been FastCGI with suexec, but php-fpm does offer quite an improvement over this).

It is worth nothing that FastCGI is actually slower than mod_php for serving a single request - however, it is usually sufficiently fast, and can handle concurrency fast better than mod_php.

share|improve this answer

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.