I have a ubuntu 14.04.4 server box and I have installed apache2 and php5 packages but after enabling mpm_worker and restart apache I got following error " Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe. You need to recompile PHP. AH00013: Pre-configuration failed" I googled this but i am unable to fix the problem. Can anyone take me to the right direction?


Ubuntu's PHP5 module will only work with the single-threaded mpm_prefork. In order to use the Apache module with the threaded mpm_worker, you will need to compile a threadsafe version of PHP yourself (which requires disabling all of the features and modules of PHP that are not threadsafe, which are a lot of them).

Instead of using libapache2-mod-php5 you should consider using FastCGI/php-fpm. There is a guide to the steps needed to install and configure libapache2-mod-fastcgi and php5-fpm here: https://askubuntu.com/a/527227 Part of configuring FPM is to create "pools" of php processes, each of which have their own limits and INI files, so you will need to be sure that the limits in FPM are reasonable for your site's expected load.

This arrangement will allow you to use the multi-threaded worker MPM in Apache while handing off the PHP requests to individual PHP processes handling a single request each.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.