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)

  • When I've run cPanel servers before I've always used suphp because of the security benefits. This page discusses some benefits of each PHP handler: liquidweb.com/kb/choosing-a-php-handler That being said, why not just run cPanel? The management overhead of running a multi user hosting system is minimized to next to nothing by using cPanel. There's a reason they own the shared hosting market
    – Joe
    Apr 4 '16 at 19:35
  • Thanks, I'll take a look at suphp. One of my servers is running Plesk. The plan is to keep the costs at the minimum, that's why I'm writing my own panel, the daemon that processes the queue(which will be populated by the web GUI) is already done, automatizing the tasks of making new system users, configuration files, apache & php reloads, it can build BIND DNS zones, make databases and mailboxes, etc. Does all that for free. Apr 4 '16 at 20:29
  • 1
    Running on a VM, cPanel costs $15/month. The amount of time it would take you to rewrite all that functionality is probably worth more than that. You get a few customers and that's paid off. The other factor to consider is why would a customer pick your platform over cPanel which is super easy and nice and looks pretty :) Not trying to say what you're doing won't work, but I've worked for a few hosting companies and have made these same decisions. For us, in each case, using cPanel was a no brainer.
    – Joe
    Apr 4 '16 at 22:18
  • Thanks for the heads up, but I like to do things myself and not pay for it if I could do it in a few weeks of time. Also, customers don't have to choose, it's not about the hosting for now, it's about making websites, hosting is just a service included. Apr 5 '16 at 10:42
  • If you can write cPanel in "a few weeks of time" I'd like some of the amphetamines you're taking.
    – ceejayoz
    Apr 5 '16 at 17:36

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:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.