docker-magento2 icon indicating copy to clipboard operation
docker-magento2 copied to clipboard

Why not use PHP-FPM ?

Open quenode opened this issue 5 years ago • 4 comments

Hi thank you very much for this project,

I was wondering any advantage of using PHP-FPM vs Apache2 (Modphp option)

Tnx

quenode avatar Aug 27 '19 10:08 quenode

there were other projects using FPM, also I never liked FPM 100%.

I think FPM it's great for website that serve static content (or pages generated by other languages) + some percentage of PHP pages, but with magento most of the requests are PHP handled, thus I think it's always better to have them directly inside the web server. All non-php requests (in this infrastructure at least) are cached by varnish never to be served again so actually (with warm cache) all requests are PHP requests.

Also, apache handles htaccess.

I've to say that now that SSL is a must and we've to have nginx as SSL incapsulator (which this project have since a while now)... it would make sense to migrate to FPM and get rid of apache, which would mean removing 1 component from the infrastructure and making it more simple, but I still like the htaccess support a lot.

fballiano avatar Aug 27 '19 10:08 fballiano

actually I'm not sure it would work cause nginx is before varnish, thus after varnish we'd need another web server before FPM right? if that's the case I can't see any benefit in switching.

fballiano avatar Aug 27 '19 10:08 fballiano

@fballiano when you look at the network of your browser, you see that a minimum of Magento requests are PHP requests. Most of them are static content requests, which can be directly served without coming to the PHP interpreter.

Mixing the PHP interpreter and the webserver, as it is when you install Magento and Apache with PHP in the same container, does not take into account that there should be one container for one job. Only when you respect this you have the benefit if exchanging components in the infrastructure, without influencing each other.

ThomasNegeli avatar Aug 27 '19 11:08 ThomasNegeli

all those requests are cached and served by varnish

fballiano avatar Aug 27 '19 11:08 fballiano