CGI stands for "Common Gateway Interface," a fancy name meaning computer programs running on the web server that can be invoked from a www page at the browser. The "bin" part alludes to the binary executables that result from compiled or assembled programs. It is a bit misleading because cgi's can also be Unix shell scripts or interpreted languages like Perl.
CGI scripts need to be saved in ASCII format and uploaded to your server's cgi-bin in ASCII or text format. This is very important.
Where to put CGI scripts
Put your cgi-bin scripts in the /public_html subdirectory named "cgi-bin".