Php – Which PHP setup should I use for a shared hosting environment (fpm, fcgi, proxy, module)

apache-2.4fastcgihostingPHPphp-fpm

I'm currently working on a web hosting management panel for running PHP websites (like Plesk or cPanel). I was researching the best possible ways of running PHP with Apache. mod_php is out of the question as an environment like this needs seperate users for each website (or subscription in my case).

I've settled with using PHP5-FPM with mod_fastcgi which worked out very well but I've discovered that the fastcgi mod is not being developed anymore. That would not be a problem as the protocol does not change but the documentation is unavailable (or I can't find it).

My exact problem: TTFB(time to first byte) on a live WordPress site is about 2s on my server and I don't like that, it's way too much with the addition of several MBs of photographs. I want constant PHP streaming but I can't seem to pull it off with this setup, and it's even harder without documentation.

Which setup should I use and why and how?

  • Apache Module (how can I get seperated users?)
  • mod_fastcgi and PHP-FPM (how can I get PHP to stream?)
  • mod_fcgid and PHP-CGI (how to do it? any tutorials?)
  • mod_proxy_fcgi and PHP-FPM (how can I get PHP to stream?)
  • Any other solution?

Thank you!
(Yes, PHP output buffering is disabled, FastCGICfg -flush did not make any difference, I've tried every solution that I've came across on the web, but it seems like nobody uses this setup with Apache, just nginx, but I need it because I have to give control to users with .htaccess files)

Best Answer

I've managed to configure it in a PHP5-CGI & mod_fcgid setup and it kind of does what I need. It does not send everything to the client as it was generated by PHP automatically, but the flush() command started to work. The TTFB times dropped a bit. I'll keep working on that and update this answer if I find out anything useful.

I've used the following sites to accomplish the current setup: