Apache 2.4 -> MPM Event and PHP-FPM

Hello,

I am considering changing the default configuration of Apache 2.4 prefork/mod_php to MPM Event and PHP-FPM on FreeBSD 13.1. If I remember correctly, this combo was said to be partially unstable some time ago.

Can anyone of you who has this combination in operation tell me something about it?

Thanks in advance and regards
Sidney2017
 
You can using php-fpm in FreeBSD. But, if is it possible, better to use nginx+php-fpm for webserver.
The only way to use apache+php-fpm is to use customer ".htaccess" without modify a main configuration of webserver.
 
If I remember correctly, this combo was said to be partially unstable some time ago.
Don't have issues with this setup.

Code:
dice@riviera:~ % ps -ax | grep httpd
  719  -  Ss      0:13.08 /usr/local/sbin/httpd
  722  -  I       0:01.15 /usr/local/sbin/httpd
  725  -  I       1:13.57 /usr/local/sbin/httpd
  727  -  I       0:54.79 /usr/local/sbin/httpd
  737  -  I       0:22.84 /usr/local/sbin/httpd
49345  0  R+      0:00.00 grep httpd
dice@riviera:~ % ps -ax | grep php
  649  -  Ss      0:10.76 php-fpm: master process (/usr/local/etc/php-fpm.conf) (php-fpm)
26864  -  I       0:15.11 php-fpm: pool www (php-fpm)
26899  -  I       0:15.62 php-fpm: pool www (php-fpm)
27266  -  I       0:03.63 php-fpm: pool www (php-fpm)
49351  0  S+      0:00.00 grep php

Make sure to remove mod_php*. In /usr/local/etc/apache24/httpd.conf change the module:
Code:
LoadModule mpm_event_module libexec/apache24/mod_mpm_event.so
#LoadModule mpm_prefork_module libexec/apache24/mod_mpm_prefork.so
#LoadModule mpm_worker_module libexec/apache24/mod_mpm_worker.so

Create a /usr/local/etc/apache24/modules.d/001_php-fpm.conf:
Code:
LoadModule proxy_module libexec/apache24/mod_proxy.so
LoadModule proxy_fcgi_module libexec/apache24/mod_proxy_fcgi.so

<IfModule proxy_fcgi_module>
  <IfModule dir_module>
     DirectoryIndex index.php
  </IfModule>
  <FilesMatch "\.(php|phtml|inc)$">
     SetHandler "proxy:fcgi://127.0.0.1:9000"
  </FilesMatch>
</IfModule>

That should be it. Make sure php-fpm is started; service php-fpm enable && service php-fpm start.
 
It has been a long time ago I worked with apache. I do however run php_fpm on a Raspberry Pi over nginx. It is a lot faster then the mod_php versions of Apache, even back then. B.t.w. using .htaccess is a penalty since it will alway be read for every request.
 
Back
Top