Home >Backend Development >PHP Problem >The difference between phpcgi and phpfpm

The difference between phpcgi and phpfpm

(*-*)浩
(*-*)浩Original
2019-10-11 15:57:242469browse

The difference between phpcgi and phpfpm

What is PHP-CGI:

PHP-CGI is the FastCGI manager that comes with PHP. (Recommended learning: PHP video tutorial)

Start PHP-CGI and use the following command:

php-cgi -b 127.0.0.1:9000

Disadvantages of PHP-CGI:

1. After php-cgi changes the php.ini configuration, you need to restart php-cgi to make the new php-ini take effect. It cannot be restarted smoothly.

2. Directly kill the php-cgi process, php It won't work. (PHP-FPM and Spawn-FCGI do not have this problem. The daemon process will smoothly regenerate new child processes.)

What is PHP-FPM

PHP- FPM is a PHP FastCGI manager, which is only used for PHP. It can be downloaded at http://php-fpm.org/download.

PHP-FPM is actually a patch of the PHP source code. Integrating FastCGI process management into PHP packages. It must be patched into your PHP source code and can be used after compiling and installing PHP.

Now we can download the branch that directly integrates PHP-FPM in the latest PHP 5.3.2 source tree. 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.

The difference between the two:

php-cgi is the called process, and php-fpm is the configuration and management process.

The above is the detailed content of The difference between phpcgi and phpfpm. For more information, please follow other related articles on the PHP Chinese website!

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

Related articles

See more