CGI Code

The Common Gateway Interface, commonly known as CGI, is a widely used standard for running scripts on a server. The CGI provides access to data and scripts on the web server, thus allowing the creation of dynamic web pages (most frequently HTML forms). The Common Gateway Interface enables the execution of scripts that run on the server in the user’s web browser. CGI scripts (or programs) are used for all kinds of dynamic (not static) web pages that may include forms or other interactive features (counters, forums, ads) or simply need to update their information constantly. The CGI code helps the webserver to understand that the page is not static and that there’s a script that it should run as a program in order to display the required data in the browser.

CGI-bin & CGI Scripts

CGI may serve various scripts that are installed on the server, so it’s very flexible and enables you to use different languages to enrich your website. Most CGI files are written in Perl, there are also CGI C or C++ scripts, CGI in PythonTclJavaVisual Basic, etc. In order for the web browser to display the data generated by the CGI code on the server, there are two crucial requirements to be met – the CGI script must be placed in the CGI-bin directory on your server and must have a .cgi file extension. That’s why you must make sure that your host provides you with access to the CGI bin. It’s not even necessary to write any CGI code, there are many free CGI scripts that you can use for your site. For Unix, you must make files executable via the “chmod” command. The CGI file should be always uploaded in ASCII mode as well.

Was this article useful?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

Newest Articles:


What you need to know: KVM (Kernel-based Virtual Machine) is a virtualization technology that is free, open-source, and available in most modern Linux distributions. Thanks to it, you can create and run Linux and Windows-based virtual machines that are independent of...

Second Level Domain (SLD)

The Second Level Domain or SLD is essential to the hierarchical Domain Name System. It is the second part of the full domain name after the Top Level Domain, on its left side. The Second Level Domain is often the same as the website name, the company, or the...

Top-Level Domain (TLD)

The Top Level Domain name (TLD) is the last or right-most fragment of the domain name. The parts of the domain name are separated with dots and form their own hierarchy in the Domain Name System (DNS). There is a Top-Leveл Domain list where you can see all available...


What is IANA? Although the Internet is not really a centralized system, there are some key infrastructure elements that need to be coordinated. The Internet Assigned Numbers Authority (IANA) is an organization that was founded in 1988 by the government of the U.S.A....


What is ICANN? ICANN is an abbreviation from Internet Corporation for Assigned Names and Numbers. It is the non-profit organization that’s responsible for the assignment and coordination of unique Internet addresses and names for all devices connected to the Internet,...

Ready to Create Your Website?