Nginx through FastCGI to run PHP than Apache contains PHP environment has obvious advantages, recent news said, PHP5.4 will be likely to include the PHP-FPM patch package in the kernel, nginx server platform to run PHP will be easier
I have previously introduced Nginx + PHP-FPM + APC = wonderful combination, recently there is a message that PHP5.4 will likely be included in the PHP-FPM (PHP FastCGI Process Manager) patch package in the kernel. This news is a big surprise for people running PHP on the nginx server platform. Maybe you have the question: "What is PHP-FPM? Why should we pay attention to it ?"
PHP-FPM is a patch for the PHP kernel, used to handle FastCGI process startup, stop and restart as needed. This is a key function, because nginx can only implement the same PHP interface through FastCGI. Nginx cannot load all PHP environments to itself like Apache. Nginx running PHP through FastCGI has obvious advantages over Apache including PHP environment:
◆ Low memory usage (because nginx does not need to load the entire PHP environment when running separately ).
◆ Easily manage user permissions (because PHP can manage different users in your server processes ).
◆ When PHP crashes, nginx can run as usual.
Its disadvantage is that, in contrast, mod_php, nginx, PHP, and FastCGI need to be installed and configured. In the past, this installation was required to add the spawn-fcgi script from the LightTPD project, and then use it to start the FastCGI process. However, this installation has some problems: it is very fragile (the process may not be restarted after it is stopped) and this installation method is very cumbersome. After nginx is installed and configured, you also need to download LightTPD, set the script specifically, set it to automatic startup, and then ensure that these scripts run properly at the same time. If you are used to "tailism" and use mod_php out of the box, you may be convinced that nginx is a poor product, especially when you have just upgraded the server to replace the original streamlined platform.
Use PHP-FPM. This patch will embed the FastCGI process management function into PHP. Therefore, when you use the FPM patch to compile PHP and select the enalbe-fpm option, nginx will control the startup and stop of the PHP process as needed. This saves the tedious configuration steps. Of course, manual patching and PHP code compilation are cumbersome for website developers who prefer to save time. Now I want to tell you the surprise of this news: PHP5.4 will directly include the FPM patch in the kernel of the PHP project!
This means you only need to download PHP to compile. You no longer need to set enalbe-fpm, you no longer need to consider how to synchronize with nginx, and you also need to try to adopt the same settings as Apache.
Maybe you have tried to run PHP on the nginx platform, and you have been so arrogant about it. I would like to solemnly suggest you try PHP-FPM. Although it still has some problems, it is constantly improving. During this period, you may be able to experience the sudden surprise of a child playing on the street with a cool toy.