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~
Mosquito interception technology + Baidu passive ...
Do you have a low immune system and the flu virus...
Editor’s Note: On November 25, 2022, the "St...
How much does it cost to develop a WeChat applet ...
Recently many people have complained online: I am...
Lao A’s practical course on selling goods on Xian...
What is the price of Anshan Chemical Mini Program...
We often find that many cancer patients are not a...
In the early stages of an Internet product’s laun...
How to direct online traffic to offline and how t...
I often hear friends complain, how can they promo...
With the disappearance of the Internet traffic di...
Recently I have been exploring a new business tha...
The automobile market was booming in 2016. Data s...