Installing apache2 with apt-get, apache2-mpm-prefork?

Solution 1:

The poster might be interested in the reasons why:

  • prefork: Every request gets its own (memory-separated) process
  • worker: Multi-threaded Apache, uses threads instead of processes, is generally faster than prefork and might use less memory.

As PHP is not thread-safe, the common suggestion is to install Apache with the "prefork" MPM. Differences between Apache MPMs: http://httpd.apache.org/docs/2.0/en/mod/#core

Short answer to your question: Debian will automatically choose the right Apache version if you're installing PHP.

Solution 2:

apt-get install libapache2-mod-php5 apache2-mpm-prefork, installing just apache2 will lead to installing mpm_prefork when you choose mod_php5 anyway

Solution 3:

This is a question of dependencies.

In this particular case, if you install apache2, it will install the default dependencies for the distribution, which might be apache2-mpm-worker instead of apache2-mpm-prefork. If what you need is prefork, it would be better to install it specifically instead of the generic apache2 package.