The development environment for PHP was recently built using vagrant. In the process of building debugging, found a lot of problems (after all, has been in the integrated development environment, one-click installation done.) )。 Further investigation of the next CGI FastCGI and PHP-FPM is summarized as follows:
Summary of one request process
What happened when you visited index.php using a browser?
Is it a little clearer to read this picture? Below is the specific explanation below.
When you enter the URL address to access index.php, your browser (client) will send a request to your server (Nginx,apache, etc.), but the server can only handle static resources such as HTML, such as php,jsp these dynamic resource server is not processed, So you need a specific parser to deal with, then the server and the parser is how to communicate (contact)? Use CGI, they communicate through the CGI, communication after the need to use PHP-FPM to parse the PHP file, after the completion of the resolution, return to the server, the server back to the browser (client), so that a request process is over.
CGI is a protocol for data exchange between Web Server and Web application.
FastCGI: The same as CGI, is a communication protocol, but it is more efficient than CGI to do some optimization.
PHP-CGI: Is the interface program for the CGI protocol provided by PHP (Web application) to Web Server.
PHP-FPM: is an interface program for the FastCGI protocol provided by PHP (Web application) to the Web Server, and additionally provides relatively intelligent task management.
CGI, fastcgi, and php-fpm relationship plots