13

I have configured FastCGI and PHP5-FPM to work on ubuntu, Which is working fine.

But i installed "apache2 worker mpm" module and wanted to configure and replace "prefork mpm" which is default in apache2.

All i found was in CentOS at /etc/sysconfig/httpd just putting HTTPD=/usr/sbin/httpd.worker will make "worker mpm" enabled.

  1. How do we enable "worker mpm" in Ubuntu?

  2. Also when i list the compiled modules of apache "/usr/sbin/apachectl -l" it wont list "prefork.c" which said to be listing since we are using it by default. But when i do "/usr/sbin/apache2 -V | grep MPM" it shows "Server MPM: prefork" can some one explain this please?

$ /usr/sbin/apache2 -V | grep MPM

Server MPM:     prefork

phpinfo();

Server API :    FPM/FastCGI
0

3 Answers 3

32

After some time of working i did it myself. You can find the steps below.

Check which MPM apache is currently running:

apachectl -V | grep -i mpm

Result:
Server MPM:     prefork

List Available MPM Modules (Make sure mpm_worker is listed)

ls /etc/apache2/mods-available/mpm*

Result:
/etc/apache2/mods-available/mpm_event.conf  /etc/apache2/mods-available/mpm_prefork.conf  /etc/apache2/mods-available/mpm_worker.conf
/etc/apache2/mods-available/mpm_event.load  /etc/apache2/mods-available/mpm_prefork.load  /etc/apache2/mods-available/mpm_worker.load

List Enabled MPM Modules (If mpm_worker is not enabled we should enable it and disable the mpm_prefork module)

ls -l /etc/apache2/mods-enabled/mpm*

Result:
/etc/apache2/mods-enabled/mpm_prefork.conf -> ../mods-available/mpm_prefork.conf
/etc/apache2/mods-enabled/mpm_prefork.load -> ../mods-available/mpm_prefork.load

Disable MPM_PREFORK module

a2dismod mpm_prefork

Enable MPM_WORKER module

a2enmod mpm_worker

To check if Apache is running on MPM WORKER

apachectl -V | grep -i mpm

Result:
Server MPM:     worker

If you get this error after executing these commands:

Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe. You need to recompile PHP

Try to remove libapache2 package:

apt-get remove libapache2-mod-php5
3
  • 2
    Followed the instruction but getting this: * Restarting web server apache2 [fail] * The apache2 configtest failed. Output of config test was: AH00534: apache2: Configuration error: More than one MPM loaded. Action 'configtest' failed. The Apache error log may have more information.
    – neobie
    Jul 29, 2015 at 6:17
  • perfect :) it's working for me. Nov 15, 2016 at 13:45
  • It is giving error "Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe. You need to recompile PHP" and removing libapache2-mod-php5 is not helping either.
    – iCyborg
    Jan 31, 2017 at 10:27
2

Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe. You need to recompile PHP.

0

If you get this error after executing these commands:

Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe. You need to recompile PHP

Try to remove libapache2 package:

apt-get remove libapache2-mod-php7.0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .