At first I thought the two were different, but after consulting a lot of information, I found out that both are actually FastCGI managers of php, and both are used to manage the php-cgi process. php-cgi comes with php. Manager, and php-fpm is a FastCGI manager specially made for PHP (it was a patch function of PHP before 5.3, and was added to PHP after 5.3, replacing the original php-cgi).
PHP-CGIPHP-CGI is the FastCGI manager that comes with PHP. Disadvantages of PHP-CGI:
php-cgi After changing the php.ini configuration, you need to restart php-cgi to make the new php-ini take effect. It cannot be restarted smoothly.
Kill the php-cgi process directly, and php will not be able to run. (PHP-FPM and Spawn-FCGI do not have this problem, the daemon process will smoothly regenerate new child processes.)
PHP-FPMPHP-FPM is a PHP FastCGI manager, only used for PHP Yes, it can be downloaded at http://php-fpm.org/download. PHP-FPM is actually a patch of PHP source code, aiming to integrate FastCGI process management into the PHP package. It must be patched into your PHP source code, and it can be used after compiling and installing PHP. Now we can download the branch that directly integrates PHP-FPM in the source code tree of the latest PHP 5.3.2. It is said that the next version will be integrated into the main branch of PHP. Compared with Spawn-FCGI, PHP-FPM has better CPU and memory control, and the former is easy to crash and must be monitored with crontab, while PHP-FPM does not have such troubles. PHP5.3.3 has integrated php-fpm and is no longer a third-party package. PHP-FPM provides a better PHP process management method, which can effectively control memory and processes, and can smoothly reload PHP configuration. It has more advantages than spawn-fcgi, so it is officially included in PHP. You can enable PHP-FPM by passing the –enable-fpm parameter in ./configure. For details, please refer to: What are CGI, FastCGI, PHP-CGI, PHP-FPM, Spawn-FCGI?
Copyright Statement: This article is an original article by the blogger and may not be reproduced without the blogger's permission.
The above introduces the understanding and correction of php-fpm and php-cgi carried in php, including the content. I hope it will be helpful to friends who are interested in PHP tutorials.