How to enable event MPM Apache 2.4 on Ubuntu 14.04 with thread safe PHP?

I upgraded to Ubuntu Server 14.04 expecting the default apache installation would use the new event MPM, but instead I find the old memory-eating prefork.

I've successfully set up event MPM in Arch Linux, but I'm failing to do so on Ubuntu. I keep getting:

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

I' ve already installed php-fpm, and configured apache2 to use it, but since the config files for apache2 are different on Ubuntu, i'm not quite sure whether i'm doing it on the right place.

Any idea on how to make PHP thread safe so I can use apache2 event-mpm? (without having to manually recompile php, of course)


To disable event MPM, you can do sudo a2dismod mpm_event and after that to enable prefork, you should do sudo a2enmod mpm_prefork.

Finally restart apache:

sudo service apache2 restart

This worked for me.

First check if you have this package installed:

dpkg -l | grep libapache2-mod-php5

If you have it just remove it:

apt-get remove libapache2-mod-php5