switch prefork to worker

How can I switch httpd to using the worker MPM instead of the prefork one?

A small bump :frowning:

The answer is “not easily, and it’s not a good idea”. :slight_smile: You’ll need to download and install the Apache SRPM and the PHP SRPM:


You’ll then need to edit /usr/src/redhat/SPECS/httpd.spec, and change all occurances of “prefork” to “worker”

and you’ll need to edit /usr/src/redhat/SPECS/php.spec and add " --with-mpm=worker "
to the configure line.

Then, you’ll need to rebuild Apache and PHP (installing any necessary devel RPMs). At that point it might work, however, even the PHP guys recommend against running PHP with the worker MPM (http://www.php.net/manual/en/install.unix.apache2.php):

Following the steps above you will have a running Apache 2.0 with support for PHP as SAPI module. Of course there are many more configuration options available for both, Apache and PHP. For more information use ./configure --help in the corresponding source tree. In case you wish to build a multithreaded version of Apache 2.0 you must overwrite the standard MPM-Module prefork either with worker or perchild. To do so append to your configure line in step 6 above either the option --with-mpm=worker or --with-mpm=perchild. Take care about the consequences and understand what you are doing. For more information read the Apache documentation about the MPM-Modules.

Note: If you want to use content negotiation, read the Apache MultiViews FAQ. 

Note: To build a multithreaded version of Apache your system must support threads. This also implies to build PHP with experimental Zend Thread Safety (ZTS). Therefore not all extensions might be available. The recommended setup is to build Apache with the standard prefork MPM-Module. 

Also, if you take a look at the list of ./configure options:

./configure --help

[B]  --enable-experimental-zts   
                          This will most likely break your build[/B]
                          If building zend_execute.lo fails, try this switch.
  --enable-memory-limit   Compile with memory limit support. 
  --enable-zend-multibyte Compile with zend multibyte support. 

It’s up to you if you want to try it, but it’s not a setup that we support.


I see… It says that worker is better for high-volume servers on apache’s site, that’s why I was asking… if it’s not a good idea then perhaps I’ll leave it as prefork for now then, and try and optimize my SQL queries for the millionth time ?_?

Thanks for the guide though :slight_smile: