Pros and Cons of mod_php vs. suexec+fcgid vs. php-fpm and Apache MPM

4 posts / 0 new
Last post
#1 Sun, 01/12/2014 - 17:58
bionitech

Pros and Cons of mod_php vs. suexec+fcgid vs. php-fpm and Apache MPM

New thread for a discussion on the pros and cons of using mod_php vs. suexec+fcgid vs. php-fpm

Discussion began here:
http://virtualmin.com/node/16963

From this page, php-fpm seems like a popularly used setup: http://blog.kmp.or.at/2013/06/apache-2-2-on-debian-wheezy-w-php-fpm-fast...

http://serverfault.com/questions/45042/which-to-install-apache-worker-or...

The classic solution to running unsafe extensions while serving large numbers (>100) of concurrent connections is to run PHP on fastCGI (mod_fcgid, a native apache module) and proxy dynamic requests to that from an apache instance that runs the Worker MPM.

This would enable you to scale from a few hundred up to >1000 concurrent connections with a modest amount of memory (4~8GB) when serving a mix of static and dynamic content.

Of course, you should also investigate front-end caching solutions as part of your overall deployment (memcached, varnish).

Alternatively, upgrade to apache 2.4 and its native event MPM, which handles concurrency in a much improved fashion (threads are fired off upon connection, not waiting to be polled.)

http://coolpandaca.wordpress.com/2012/03/20/apache-mpm-worker-prefork-mo...

(Good overview)

Mon, 01/13/2014 - 06:18
Chris_C

Which setup gives the most security, between virtual servers, and virtual server vs. system ?

Most efficient use of memory, for apache and PHP?

Most efficient use of cached, pre-compiled PHP opcodes shared between virtual servers running same or similar PHP apps ?

Best ability to handle high loads efficiently ?

Wed, 01/29/2014 - 04:05
Beluga

In the thread: http://www.virtualmin.com/node/22660 It is said: "Unfortunately, PHP-FPM isn't one of the supported PHP Execution Modes."

Does this mean we can't use Virtualmin with Apache + PHP-FPM at all?

Wed, 01/29/2014 - 07:12 (Reply to #3)
Chris_C

Currently it seems you can add a custom user script to enable/maintain Apache + PHP-FPM with Virtualmin, but it's officially unsupported. User janeksikora has created a script to do this with nginx + PHP-FPM...

"I've managed to do php-fpm&nginx with a 100 line script that is executing after creating/destroying vservers (it creates php-fpm pool for each host) and modyfing source of virtualmin-nginx module (so it uses sockets -- easier [sockets are like $user.socket] and faster [than TCP]). Wasn't so hard..."