What is CGI?
CGI (Common Gateway Interface) is a tool used for creating dynamic web content. The CGI environment allows communication to occur between CGI programs, the web server and the client. For example, a visitor fills out information on a web page, submits it to the web servers that processes the information using a CGI program and simultaneously submits the information to a mail server and serves a response page back to the client.
What is a CGI-BIN?
Your cgi-bin is the environment that NetHere has set up within your root directory. You need to store your cgi programs within the cgi-bin directory in order for them to be executed by your web pages.
Although languages used for CGI programs include, Perl, Visual Basic, C, and others, by far the most popular is Perl. Perl (Practical Extraction and Report Language) code is written in a text file, known as a script, and can be saved as either a .pl file or .cgi file. Perl is non-compiled code, unlike C or C++.
Requirements for Running Your CGI Scripts
- For sites hosted on a Unix platform
- Upload your scripts in ASCII, not binary, within the cgi-bin.
- Make sure you change the permissions for the scripts to execute. If the script is writing to a file, you would need to set write permissions on the file as well. If you have any issues with adjusting the permissions, please contact us and we will adjust the permissions for you.
- The path to the perl module is #!/usr/bin/perl
- The file can be saved as either .cgi or .pl. If you have a script compiled in a language other than perl, you will need to save it as a .cgi file type.
- For sites hosted on a Windows platform
- Contact firstname.lastname@example.org so that we can enable Perl for your web site and create your cgi-bin directory for your scripts.
- Save your Perl script as a .pl file.
- Upload your script to the cgi-bin. No need to adjust permissions, they are already set to execute by default.