php mode

Amin El-Zein
Amin El-Zein used Ask the Experts™
which is better for apache using php-mod or php-fpm ?
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
mod_php is simpler to install and configure, but it's slower and takes up more memory than PHP-FPM because it's loading the PHP engine into the Apache workers and it is basically starting up the engine each time. PHP-FPM keeps several PHP workers running at all times, so that it doesn't take time to start up the PHP engine in order to execute a script, and the web server workers don't have to load PHP into memory.

If you want quick-and-easy, then use mod_php. If you want more manual, technical implementations with more flexibility and you are comfortable with configuring the system, then PHP-FPM is the best option.
David FavorFractional CTO
Distinguished Expert 2018
There is no better. There are differences.

You must use MPM Event + PHP FPM to run HTTP/2.0 protocol.

Old versions of Apache-2.4 allowed running HTTP/2.0 with libapache2-mod-php + this always leads to problems, as libapache2-mod-php is single threaded + HTTP/2.0 is multi-threaded.

If you're looking for best long term solution, use MPM Event + PHP FPM.

Tip: If you use Ubuntu Bionic + latest stable repositories, then all Apache + PHP updates package + release very quickly.

For example, here are versions running today...

lxd: net14-clients # apachectl -V | head
Server version: Apache/2.4.41 (Ubuntu)
Server built:   2019-08-21T20:43:21
Server's Module Magic Number: 20120211:88
Server loaded:  APR 1.7.0, APR-UTIL 1.6.1
Compiled using: APR 1.6.3, APR-UTIL 1.6.1
Architecture:   64-bit
Server MPM:     event
  threaded:     yes (fixed thread count)
    forked:     yes (variable process count)
Server compiled with....

lxd: net14-clients # php --version
PHP (cli) (built: Oct  8 2019 05:33:38) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.10, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache, Copyright (c) 1999-2018, by Zend Technologies

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial