With recent versions of Apache, it has become a lot easier to use PHP-FPM, and with Ubuntu 16.04 being packaged with PHP 7 when it is released later this month, I thought it was worth a quick how to use all these technologies together.
Firstly, you will need to install the required applications, which this one simple command:
sudo apt install apache2 php
That’s not too different to how you would have installed it in previous versions of Ubuntu, and it will default to Php 7.
Now that they’re installed, there is a small amount of configuration needed. Run these simple commands in this order:
sudo a2dismod mpm_prefork php7.0 sudo a2enmod mpm_event proxy_fcgi sudo a2enconf php7.0-fpm sudo systemctl restart apache2
Now that should be everything complete.
Thank you. This was beginning to drive me crazy!
No problems!
I’m trying to use the mpm_event handler and getting the error:
“Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe. You need to recompile PHP.”
This is a recently upgraded Ubuntu installation but I believe I’ve completely uninstalled php5. Everywhere I’ve seen this error, people have suggested moving over to mpm_prefork but I’d much prefer mpm_event if I can get it working. Any suggestions?
Naturally, 10 minutes after posting I came across a post by Tim Jones pointing me to a PPA that seems to solve the problem for me:
https://phpraxis.wordpress.com/2016/05/16/install-php-5-6-or-5-5-in-ubuntu-16-04-lts-xenial-xerus/
I posted a summary of the steps I used to address it here as well:
http://www.185vfx.com/2016/10/php7-0-and-apache-event-mpm/
Hope that helps someone!
I have read and tried 25 things that did not work, this rocks! 😀 Thank you so much.