James John – Software Engineer

FIX: Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe in Fedora

After a cool morning on upgrading to Fedora 27, I faced an issue when i tried to resume a web project I was working on. Apache wasn’t running and I checked what was wrong with

$ sudo systemctl status httpd

 

And caught this error as part of the debug:

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

Really? I have to recompile PHP to enable threadsafe? Hell no!

I tried to disable MPM from Apache but turns on it needs it to run. Reading the docs in /etc/httpd/conf.modules.d/00-mpm.conf I came across this:

# prefork MPM: Implements a non-threaded, pre-forking web server
# See: http://httpd.apache.org/docs/2.4/mod/prefork.html
#
# NOTE: If enabling prefork, the httpd_graceful_shutdown SELinux
# boolean should be enabled, to allow graceful stop/shutdown.
#
#LoadModule mpm_prefork_module modules/mod_mpm_prefork.so

 

Life saver! All I had to do is to enable mod_mpm_prefork.so and disable mod_mpm_event.so. So lets do this, edit the file /etc/httpd/conf.modules.d/00-mpm.conf

Replace

LoadModule mpm_event_module modules/mod_mpm_event.so

With

LoadModule mpm_prefork_module modules/mod_mpm_prefork.so

Save the file and restart Apache. Voila!!! 😀
 

James John

Software Engineer