Often see these things, but the information on the Internet to see not understand, which can be popular to say.
Concept understanding: cgi,fastcgi,php-cgi and PHP-FPM
Better give me a chestnut!
Thank you
Reply content:
Often see these things, but the information on the Internet to see not understand, which can be popular to say.
Concept understanding: cgi,fastcgi,php-cgi and PHP-FPM
Better give me a chestnut!
Thank you
CGI is a set of interface rules that are used for the establishment of communication between HTTP servers and dynamic handlers.
FASTCGI is an implementation of CGI, which allows a CGI process to process multiple requests, reducing the time and resource consumption of repeatedly starting CGI programs by allowing the CGI handler to be resident.
PHP-CGI is a fastcgi to provide PHP program processing.
PHP-FPM (FastCGI process Manager) is a management tool that manages FastCGI processes on top of FastCGI programs.
PHP-CGI is a single process, when a php-cgi is opened to process a request, only one request can be processed at a time, and the remaining requests are queued.
PHP-FPM manages multiple fastcgi processes, allowing requests to be sent in parallel to multiple fastcgi processes at the same time.
It is easy to understand that PHP-FPM manages multiple php-cgi
For a simple example, a request is sent from the client to the Nginx server and then processed by the PHP program:
The request is sent to the Nginx server, the Nginx server is configured to send it to PHP-FPM, but Nginx and PHP-FPM are the products of two companies, if they make sure that they can read each other's message content? This is because they follow the rules of CGI when they are designed.
PHP-FPM receives the request, it finds an idle process in the FASTCGI process that it manages to handle the request
In addition Nginx can also docking php-cgi, but php-cgi no process management module, and is a single process.
Referring to Yinguan's answer, the relationship between FastCGI and PHP-FPM