CGI stands for Common Gateway Interface, which allows a client to request data from a web browser to a program running on a web server. CGI describes a standard for transmitting data between a client and the program. One of the purposes of CGI is to be independent of any language, so CGI can be written in any language as long as the language has standard input, output and environment variables, such as php, perl, tcl, etc. FastCGI is a protocol for communication between web servers and processing programs. It is an improvement on CGI. FastCGI is like a long-live CGI. It can be executed all the time. When a request arrives, it will not take time to fork a process to handle it (this is the most criticized fork-and-execute mode of CGI). Because it is just a communication protocol, it also supports distributed computing, that is, FastCGI programs can be executed on hosts other than web servers and accept requests from other web servers. FastCGI is a language-independent, scalable open extension of CGI that keeps the CGI interpreter process in memory to achieve higher performance. Repeated loading of CGI programs is the main reason for poor CGI performance. If CGI programs are kept in memory and scheduled by the FastCGI process manager, good performance, scalability, and fail-over features can be provided. In general, the entire workflow of FastCGI is as follows:
PHP's CGI implements the Fastcgi protocol. It is a TCP or UDP protocol server that accepts requests from Web servers. When it starts, it creates a TCP/UDP protocol server socket listener and receives related requests for processing. Then it enters the PHP life cycle: module initialization, sapi initialization, processing PHP requests, module shutdown, sapi shutdown, etc., which constitute the entire CGI life cycle. Taking TCP as an example, on the TCP server side, the following steps are generally performed:
PHP FastCGI enables all of your PHP applications to run through mod_fastci instead of mod_phpsusexec. FastCGI applications are fast because they are persistent and do not have to be started and initialized for every request. This makes it possible to develop applications that would otherwise be impractical in the CGI paradigm (such as a large script, or an application that needs to connect to single or multiple databases). Advantages of FastCGI:
But there are potential problems:
|
<<: The third round of the Aite Tribe Story Collection with prizes has begun~
The EU's imposition of tariffs on Chinese-mad...
The author of this article conducted a market ana...
Some time ago, I bought a bag for my wife on an e...
We have been monitoring data and dynamics of all ...
How many times has your circle of friends been fl...
Do you believe it? Everything in the world will g...
Recently, Musk, CEO of SpaceX, announced that Sta...
Although event planning is very important, when w...
Imagination is a talent as well as a skill! In th...
Clothing goods delivery expert analysis course re...
In 2020, community commerce is developing in full...
In Shandong, Liaoning, Zhejiang and other places,...
Recommended by Taoist Priest Jiulong - Teacher Ji...
[[244587]] Recently, Apple's two new mobile p...