Nov 4, 2015
Let me start by clearing up a possible source of confusion for those of you familiar with FastCGI. This project is not about PHP-FPM. PHP-FPM is a great way of improving the performance of PHP applications, but the way it works is different to PHPFastCGI.
PHP-FPM keeps the PHP interpreter alive between HTTP request cycles.
PHPFastCGI keeps the PHP application alive between HTTP request cycles.
That’s all of your services, configuration… everything.
For a simple 500 page Symfony application, PHPFastCGI can take the performance from 280 rq/s to 1770 rq/s. If you’re interested, check the post on how the benchmarks were conducted. To summarize, I tried to make the Symfony application as fast as I could (OPCache enabled, PHP-FPM, NGINX). Then, I ran it as a PHPFastCGI application and compared the performance.
Please do not take those benchmarks too seriously (though I believe that they are significant). The top results were collected using a PHP extension that is currently lacking a few features (and not as stable as the default PHP implementation of the protocol). Also, a very helpful commenter has pointed out some ways that I could improve the benchmarks. As a result, I will be re-running them shortly.
Regardless, any application that has to reload itself on every HTTP request cycle will be significantly slower than a version of the same application that does not.
Before doing this with an application, please read the post on things to consider when using PHPFastCGI with your application.
If your still think that your application is ready to be run in this way, it is really easy to create a FastCGI application using PHPFastCGI. With a Symfony application, you can do it by just installing a bundle.
You can also use the project without a framework, using the core FastCGIDaemon.
A framework-less PHPFastCGI application looks like this:
Also - as a cheeky request - if you like the sound of this project it would make me very happy if you shared it with your developer friends or gave it a star on GitHub.