Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change apache mpm from event to prefork

Tags:

apache2

I recently installed Apache/2.4.6 from source. At present the MPM module enabled is mpm_event_module. I want to enable the prefork mpm, but not sure from where to do that. I am aware of changing the mpm module from /etc/sysconfig/httpd in case of the apache installed using yum. But in my case as the installinon is from source, I could not not do the same. I tried recompiling apche using './configure --prefix=/usr/local/apache --enable-module=prefork' , but the mpm is still mpm_event_module. Clearly the issue is with defining prefork as the mpm.

I could also see that the installation directory has the prefork.c module. There must be a way to define it as the mpm.

Could someone please help.

like image 376
Rijo Thomas Avatar asked Sep 04 '13 08:09

Rijo Thomas


1 Answers

In versions prior to 2.4, you cannot change the MPM of the binary Apache2 installation at run-time.

You have to compile Apache with the desired MPM using the --with-mpm=MODULE NAME command line option to the config script. To change MPM, the binary must be rebuilt.

You can determine which MPM Apache2 is currently built with by executing apache2 -l or httpd -l on the command line.

Brief but very clear documentation on this:

http://httpd.apache.org/docs/2.2/mpm.html

In version 2.4, you can also build MPMs as dynamic modules which allows changing the MPM at run-time.

http://httpd.apache.org/docs/2.4/mpm.html#dynamic

like image 118
marekful Avatar answered Oct 30 '22 13:10

marekful