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~
Autonomous driving is not something that is out o...
This is an article written for the 20 million sel...
To judge whether a product is successful, technic...
Many startups are interested in trying to discove...
There are too many Internet financial products. H...
When the market is selling various screen-swiping...
Some people say that a community is a net woven b...
The author of this article once created a video o...
While many domestic automakers are determined to ...
Self-driving cars have become an emerging technol...
If I were to say which APP is the most popular in...
After participating in the B round of financing t...
When it comes to orange cats, the keywords that c...