CGI Code

Hosting Encyclopedia » CGI Code

The Common Gateway Interface, commonly known as CGI, is widely used standard for running scripts on a server. The CGI provides access to data and scripts on the webserver, 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 kind 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.

It's Time to Share Your Story.

Get Free Web Hosting. Start a website, and introduce yourself to the world.

Are You Ready to Create Your Website?