What is CGI?
Common Gateway Interface (also known as CGI) is not a kind of language but just a specification(set of rules) that helps to establish a dynamic interaction between a web application and the browser (or the client application). The CGI programs make possible communication between client and web servers. Whenever the client browser sends a request to the webserver the CGI programs send the output back to the web server based on the input provided by the client-server.
- CGI is the standard for programs to interface with HTTP servers.
- CGI programming is written dynamically generating webpages that respond to user input or webpages that interact with software on the server
Working of CGI
When a request is made by the client-server to the webserver, the CGI uses external script files to handle such requests. These files could be written in any language. The main objective of these script files is to retrieve the data from the database quickly and more efficiently. These scripts convert the retrieved data into an Html format that sends the data to these web servers in Html formatted page.
Install apache2 on your system can we will run ‘hello.py’ on host ‘127.0.0.1’
It is recommended to have basic knowledge of HTML before trying this example.
Some advantages of CGI are discussed as below:
1 They are portable and can work on almost any web server and operating system.
2 They are language-independent.
3 They are quite scalable programs in nature which means they can perform both simple and complex tasks.
4 CGIs enhance dynamic communication in web applications.
5They also aid in making businesses more profitable by decreasing development and maintenance costs.
Some disadvantages of CGI are as below:
1 The interpreter has to evaluate a CGI script every time the program is initiated this creates a lot of traffic as there are too many requests from the side of the client-server.
2 Programming and designing of CGI programs is very complex and ambiguous.
3 CGI programs may compromise server security as most of them are free and easily available making them quite vulnerable.
This article is contributed by Harsh Wardhan Chaudhary (Intern). If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.
- What is CGI in Python ?
- A basic Python Programming Challenge
- Object Oriented Programming in Python | Set 1 (Class, Object and Members)
- Object Oriented Programming in Python | Set 2 (Data Hiding and Object Printing)
- Command Line Interface Programming in Python
- Python Input Methods for Competitive Programming
- Socket Programming with Multi-threading in Python
- Python in Competitive Programming
- Python - Fastest Growing Programming Language
- Why is Python the Best-Suited Programming Language for Machine Learning?
- Difference Between Go and Python Programming Language
- Python | Linear Programming in Pulp
- Functional Programming in Python
- Python program to find GSoC organisations that use a Particular Programming Language
- Programming Paradigms in Python
- Python | Implementing Dynamic programming using Dictionary
- Which Python Modules are useful for competitive programming?
- Comparison of Python with Other Programming Languages
- Mathematics Tricks For Competitive Programming In Python 3
- How to Create a Programming Language using Python?