10
votes

All tutorials I found were how to fresh install worker MPM + PHP-FPM, since my wordpress blog's already up and running with prefork MPM, correct me if I'm wrong in the simulated installation process:

I'm on ubuntu and according to some tutorials, the following lines would do all the tricks:

apt-get install apache2-mpm-worker libapache2-mod-fastcgi php5-fpm php5-gd
a2enmod actions fastcgi alias

Then you setup configuration in /etc/apache2/conf.d/php5-fpm.conf:

<IfModule mod_fastcgi.c>
                AddHandler php5-fcgi .php
                Action php5-fcgi /php5-fcgi
                Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi
                FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -host 127.0.0.1:9000 -pass-header Authorization
</IfModule>

After all these, restart:

service apache2 restart && service php5-fpm restart

Question:

1) Would it cause any down time in the whole process for previously running sites with prefork MPM?

2) Do you have to change any already existent configuration files like php or mysql or apache2(would they take effect immediately after the switch without you doing anything)?

3) I've already have apc up and running, do you have to re-install/re-configure it after the switch?

4) How do you find out if apache2 is working in worker MPM mode as expected?

Thanks a lot!

1
I'm in the process of doing the same. Do you mind if I ask did you do this and did it work seamlessly or were there issues?Stephen Baugh
@StephenBaugh: If I recall correctly there's only a minute or two downtime since prefork MPM and worker MPM cannot exist at the same time, which means once apt-get install apache2-mpm-worker starts the old prefork MPM apache server would stop immediately and begin to uninstall first, and after you installed everything from apt-get ... and correctly setup the configurations, service apache2 restart && service php5-fpm restart should get the server back to work at worker MPM mode.Shane
Thanks Shane. I really appreciate you taking the time to respond. We're on AWS so I'll just spin up an instance and try it on that in the development environment. Nice to know that was the only issue you had.Stephen Baugh
As a side-note you could use nginx to avoid downtime (e.g. nginx reload) and it also works great with php-fpm.adrian7

1 Answers

5
votes
  1. yes, it has to at least replace the httpd process running. you definitely want to test this on a development set up first. it's easy to have a mistake in a config file that takes a while to figure out.

  2. no changes to php, mysql. yes changes to apache httpd.conf to put in worker configurations - they are very different from prefork settings. you need to do these changes yourself in httpd.conf.

  3. no, since this is a php module, whenever php runs it works. that said, it will run one copy for each pool in php-fpm, so if you have multiple domains, you could group them into a pool to share...but be aware of security concerns if you do that.

  4. httpd -V shows "server mpm"

good luck!