CGI: A program running on a server that provides an interface to client HTML. ( common gateway interface common gateway interface)
CGI is not limited to the language used.
How CGI works:
First, the browser accesses the URL and connects to the server. After the web server receives the request information, it parses the URL to find out whether the accessed file exists on the server. If it exists, it returns the content of the file, otherwise it returns an error message. The browser receives the information from the server and displays the accepted file or the received error message.
Disadvantage : A copy of the program is generated for each CGI request to run.
Improvement : FastCGI compiles first, mod_perl integrates the interpreter as a module in the web server, and uses compiled languages such as C.
CGI environment variables:
content_type
http_cookie
remode_addr
request_method (method the script is called by, such as EGT and POST)
GET method and POST method
Python's own web server
Apache
The first CGI program (four steps):
Create a directory
Write CGI programs
start the server
Access using browser