Frequently asked questions

Back
Keyword:  

How do I use CGI scripts?
If you have web hosting Medium or larger, you also have access to run CGI scripts.

A CGI script is a small program that runs on the web server, and may generate different HTML code each time, depending on the input parameters.

You may create CGI scripts in e.g. Perl (/usr/bin/perl), Python (/usr/bin/python), Ruby (/usr/bin/ruby) and Bash (/bin/bash).

Note: Django, Ruby on Rails, or other specific webserver modules are neither provided nor supported.

The CGI scripts may be placed in any directory (not only /cgi-bin), but the filenames must use the extension ".cgi", not ".pl" or any other extensions.

All CGI scripts and the directories/folders must have correct permissions ("chmod 0750 filename" or "chmod u=rwx,g=rx filename" in Unix shell). For security reasons, it will not work if other people than the owner, have write permission to the CGI files.

Here is a CGI script example written in Perl, and here is the source code.

If you need the full path of your file directory for a CGI script, use /home/1/m/myname/www/, where "myname" is your FTP username. Remember to replace "1/m" with the appropriate number for your home directory and the first letter of your FTP username.

Note! CGI scripts must use Unix newlines (LF), and not DOS/Windows (CR/LF). Most FTP clients convert automatically during transfer, this also goes for many of the good text editors (TextPad, BBEdit, Emacs, UltraEdit).

See also:

© 2024 Domeneshop AS · About us · Terms · Privacy policy