What exactly does CGI, FastCGI, and php_fpm matter?

Source: Internet
Author: User

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

Related Article

Cloud Intelligence Leading the Digital Future

Alibaba Cloud ACtivate Online Conference, Nov. 20th & 21st, 2019 (UTC+08)

Register Now >

11.11 Big Sale for Cloud

Get Unbeatable Offers with up to 90% Off,Oct.24-Nov.13 (UTC+8)

Get It Now >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.