6

I have a debian 6 at 64bit. I want install lamp. On some website i find:

apt-get install apache2

on some other:

apt-get install apache-mpm-prefork

Which one should I choose?

Thanks

dynamic
  • 730
  • 6
  • 17
  • 31

4 Answers4

16

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.

weeheavy
  • 4,039
  • 1
  • 27
  • 41
3

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

Alex
  • 7,789
  • 4
  • 36
  • 51
  • hm okay so it's not a choice :D I will use this then `apt-get install apache2-mpm-prefork libapache2-mod-php5 mysql-server php5-mysql php5-gd` – dynamic Feb 08 '11 at 23:31
1

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.

sybreon
  • 7,357
  • 1
  • 19
  • 19
0

I suggest you to use aptitude for those tasks, it will provide a ncurses interface which shows you all the dependencies and allows you to change your choices before the actual install process. It's simply the best tool for package management.

In your case you have to start aptitude, then press / and enter apache2 (which is a virtual package used for dependencies tracking), once highlighted press + and the packages will be selected with all its dependencies, then press g and in the next screen you can review what will be installed and change it if needed. When you're done press g again and the install process will start.

aptitude manual

Edit: for lamp you have to select also the php5 package which provide all the php infrastructure both for apache and php cli scripts, the mysql-server package which provides the mysql server and the php5-mysql package which provides the php mysql and pdo functions.

Fabio
  • 1,287
  • 2
  • 12
  • 18
  • This link is non-functional (I checked after 10 years of the answer above, though) http://algebraicthunk.net/~dburrows/projects/aptitude/doc/en/ – Ankur Kumar Feb 01 '21 at 13:25