Support

Linux Apache CGI Scripts

CGI scripts are little programs that can be executed from web browser of from shell. Apache recognizes all files in a CGI-BIN directory as being eligible for execution rather than processing as normal documents. This applies regardless of the file name, so scripts in a CGI-BIN directory don't need to be named "*.cgi" or "*.pl" or whatever. In other words, all files in a CGI-BIN directory are scripts, as far as Apache is concerned.

How do I execute my CGI scripts?

You should upload your CGI scripts to cgi-bin folder that is located under htdocs.

Files that are located in cgi-bin folder are recognized by web-server as CGI programs and run from the shell. To make CGI scripts run at your account you should do the following:

  1. Set the path to interpreter at your script at the first line (i.e. #!/usr/bin/perl for Perl scripts).
  2. Upload your script to cgi-bin folder.
  3. Set execution mode to your script. (i.e. you can do it via ftp by "quote site chmod 755 filename" command).
  4. Run it via web browser (http://yourdomain/cgi-bin/filename). You will need to put a link to the script into a web page and, possibly, create form that will submit all necessary information to the script.

Examples of CGI scripts

Perl scripts:

PHP scripts: