Home  >  Article  >  Backend Development  >  Running PHP on the nginx platform will become very easy_PHP tutorial

Running PHP on the nginx platform will become very easy_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:39:48813browse

PHP5.4 will most likely include the PHP-FPM (PHP FastCGI Process Manager) patch in the kernel. This news comes as a big surprise to people running PHP on the nginx server platform. Maybe you have this question: "What is PHP-FPM? Why should we pay attention to it?"

PHP-FPM is a patch written for the PHP kernel to handle the startup of the FastCGI process as needed. Stop and restart. This is a very critical function, because nginx can only interface with PHP through FastCGI. nginx cannot load all PHP environments into itself like Apache. nginx running PHP through FastCGI has obvious advantages over Apache including a PHP environment:
* Lower memory usage (because nginx does not need to load the entire PHP environment when running alone).
* Easily manage user permissions (because PHP can manage different users within your server process).
* When PHP crashes, nginx can run as usual.

Its disadvantage is that it requires the installation and setup of mod_php, nginx, PHP and FastCGI. In the past, this installation required co-opting the spawn-fcgi script from the LightTPD project and then using it to start the FastCGI process. However, there are some problems with this installation: it is fragile (the process may not restart properly when it is stopped) and this installation method is very cumbersome. After installing and configuring nginx, you need to download LightTPD, set up the script accordingly, set it to start automatically, and then ensure that these run normally at the same time. If you are used to "borrowing" and using mod_php out of the box, then you may be convinced that nginx is an inferior product, especially if you have just upgraded the server to replace the original streamlined platform.

Use PHP-FPM. This patch will embed FastCGI process management functionality into PHP. So when you use the FPM patch to compile PHP and select the enable-fpm option, nginx will control the starting and stopping of the PHP process as needed. This eliminates the previous tedious configuration steps. Of course, for website developers who like to save trouble, manually configuring patches and compiling PHP code is still a bit cumbersome. Now I want to tell you the surprise this news brings to us: PHP5.4 will include the FPM patch directly into the core of the PHP project!

This means you only need to download PHP to compile. You no longer need to set up enable-fpm, no longer need to worry about how to synchronize with nginx, and no longer need to try to adopt the same settings as Apache.

Maybe you have tried running PHP on the nginx platform and cursed at its complexity. I would strongly recommend you to give PHP-FPM a try. Although it still has some problems, it is improving all the time. During this period, maybe you can experience the surprise of a child playing on the street suddenly getting a cool toy.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/486248.htmlTechArticlePHP5.4 will most likely include the PHP-FPM (PHP FastCGI Process Manager) patch in the kernel. This news comes as a big surprise to people running PHP on the nginx server platform. ...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn