Home Backend Development PHP Tutorial The relationship between cgi, fast-cgi and php-fpm (with flow chart)

The relationship between cgi, fast-cgi and php-fpm (with flow chart)

Oct 08, 2022 pm 02:07 PM
php-fpm cgi fast-cgi

The relationship between cgi, fast-cgi and php-fpm (with flow chart)

First let’s talk about CGI

  • cgi is a protocol and has nothing to do with the process. For example, the web server (nginx) receives a PHP network request. At this time, nginx needs to find the PHP parser according to the configuration file. After simple processing, some of the requested information is handed over to the PHP parser. At this time, it is stipulated Which protocols should be transmitted, and in what format, this standard is called cgi protocol

  • #php explanation is the cgi program that implements this protocol, nginx hands these contents to php After the interpreter, it reads the initialization environment such as php.ini, then processes the data, and finally converts it into a data stream that conforms to this protocol and sends it to nginx, and finally returns it to the browser [Recommendation: PHP Video Tutorial]

fast-cgi manages cgi program

  • fast-cgi is a resident process program, and cgi is used for each The difference between a web request and a process is that fast-cgi will start multiple cgi programs at the same time when the web server starts, so that when a dynamic page request comes in, the data flow can be handed over to the fast-cgi process manager, so The advantage is that the web server can handle more requests and parse php.ini only once, which improves the response speed.

The diagram is as follows

The relationship between cgi, fast-cgi and php-fpm (with flow chart)

php-fpm manages cgi program

  • First of all, php-fpm is the product of integrating fast-cgi and adding some new functions. Since the fast-cgi program provided by the web server has many shortcomings when managing php-cgi, for example, if the configuration file of php.ini is modified, the web server must be restarted to make it take effect (php-cgi cannot start smoothly and kills PHP cannot work normally when using php-cgi), these problems can be solved when using php-fpm

The flow chart at this time is as follows

The relationship between cgi, fast-cgi and php-fpm (with flow chart)

The above is the detailed content of The relationship between cgi, fast-cgi and php-fpm (with flow chart). For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Two Point Museum: All Exhibits And Where To Find Them
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to use php-fpm for high-performance tuning How to use php-fpm for high-performance tuning Jul 08, 2023 am 11:30 AM

How to use php-fpm for high-performance tuning PHP is a very popular server-side scripting language that is widely used to develop web applications and dynamic websites. However, as traffic increases, the performance of your PHP application may suffer. In order to solve this problem, we can use php-fpm (FastCGIProcessManager) for high-performance tuning. This article will introduce how to use php-fpm to improve the performance of PHP applications and provide code examples. one,

How to use PHP-FPM optimization to improve the performance of PrestaShop applications How to use PHP-FPM optimization to improve the performance of PrestaShop applications Oct 05, 2023 pm 12:33 PM

How to use PHP-FPM optimization to improve the performance of PrestaShop applications. With the rapid development of the e-commerce industry, PrestaShop has become the e-commerce platform chosen by many merchants. However, as the size of the store increases and the number of visits increases, the PrestaShop application may encounter performance bottlenecks. In order to improve the performance of the PrestaShop application, a common method is to use PHP-FPM to optimize and improve the application's processing capabilities. PHP-FPM (FastCGI

How to improve the performance of your WooCommerce application using PHP-FPM optimization How to improve the performance of your WooCommerce application using PHP-FPM optimization Oct 05, 2023 am 08:24 AM

How to Improve the Performance of WooCommerce Applications Using PHP-FPM Optimization Overview WooCommerce is a very popular e-commerce plugin for creating and managing online stores on WordPress websites. However, as your store grows and traffic increases, WooCommerce apps can become slow and unstable. To solve this problem, we can use PHP-FPM to optimize and improve the performance of WooCommerce applications. What is PHP-FP

Use php-fpm connection pool to improve database access performance Use php-fpm connection pool to improve database access performance Jul 07, 2023 am 09:24 AM

Overview of using php-fpm connection pool to improve database access performance: In web development, database access is one of the most frequent and time-consuming operations. The traditional method is to create a new database connection for each database operation and then close the connection after use. This method will cause frequent establishment and closing of database connections, increasing system overhead. In order to solve this problem, you can use php-fpm connection pool technology to improve database access performance. Principle of connection pool: Connection pool is a caching technology that combines a certain number of databases

Detailed explanation of php-fpm tuning method Detailed explanation of php-fpm tuning method Jul 08, 2023 pm 04:31 PM

PHP-FPM is a commonly used PHP process manager used to provide better PHP performance and stability. However, in a high-load environment, the default configuration of PHP-FPM may not meet the needs, so we need to tune it. This article will introduce the tuning method of PHP-FPM in detail and give some code examples. 1. Increase the number of processes. By default, PHP-FPM only starts a small number of processes to handle requests. In a high-load environment, we can improve the concurrency of PHP-FPM by increasing the number of processes

How to use PHP-FPM optimization to improve the performance of Phalcon applications How to use PHP-FPM optimization to improve the performance of Phalcon applications Oct 05, 2023 pm 01:54 PM

How to use PHP-FPM to optimize and improve the performance of Phalcon applications. Introduction: Phalcon is a high-performance PHP framework. Combining with PHP-FPM can further improve the performance of applications. This article will introduce how to use PHP-FPM to optimize the performance of Phalcon applications and provide specific code examples. 1. What is PHP-FPMPHP-FPM (PHPFastCGIProcessManager) is a PHP process independent of the web server

What to do if ubuntu doesn't have php-fpm What to do if ubuntu doesn't have php-fpm Feb 03, 2023 am 10:51 AM

Solution for Ubuntu without php-fpm: 1. Add the source address of PHP by executing the "sudo apt-get" command; 2. Check whether there is a php7 package; 3. Install PHP by executing the "sudo apt-get install" command; 4. , modify the configuration to listen on port 9000 to handle nginx requests; 5. Start "php7.2-fpm" through "sudo service php7.2-fpm start".

PHP and CGI file upload and download technology: how to implement file management functions PHP and CGI file upload and download technology: how to implement file management functions Jul 21, 2023 am 11:19 AM

File upload and download technology with PHP and CGI: How to implement file management functions Introduction: File upload and download are one of the common functions in modern web applications. This article will introduce how to implement file upload and download functions using PHP and CGI programming languages, and show some code examples to demonstrate how to manage uploaded and downloaded files. Here’s what we’re going to cover: Basic concepts of file upload using PHP to implement file upload CGI to implement file upload Basic concepts of file download using PHP to implement file download CGI implementation under the file

See all articles