CGI scripts
Customers with websites hosted on Unix can use CGI scripts, which require
some minor preparation before they will work.
CGI scripts explained
A CGI script is an executable program which sends its output to a visitor's web browser. Most CGI scripts are text files, usually written in a language like Perl or Python.Uploading CGI scripts
Windows and Unix handle text files differently. Whereas Windows terminates the lines of a text file with invisible "carriage return" and "line feed" characters (known as CRLF), Unix uses only the line feed character (referred to as "newline" in Unix). For this reason, text files, including CGI scripts, must be converted when they are uploaded from your computer to the server. Your FTP software will perform this conversion automatically when you upload a text file in ASCII mode. If you edit a CGI script on your Windows computer, then transfer it using FTP, ensure you upload it in ASCII mode, and not in binary mode. Uploading in ASCII mode will strip out the additional end-of-line characters from Windows-encoded text files. If the script is uploaded in binary mode, it will not run; instead, the server will display an "Internal server error" message. You may upload your CGI script to any folder on your website, although the cgi-bin folder is specifically intended for CGI scripts. Any file located in cgi-bin will be assumed by the server to be a CGI script. If you want to run the script from any other folder, make sure the script has the .cgi filename extension.File permissions for scripts
Since a script is a program that must be executed by the server, it requires special file permissions to allow it to run. In Unix, this is called the "execute" permission. For security, all CGI scripts on Korax servers run under the identity of the user name that owns them; that is, your Korax account user name. This means that the maximum permission needed for your script to run is 700. These are the permissions for owner read, write, and execute. "Group" and "other" should have no permissions enabled on your script files. If you set your script to be writable by anyone other than yourself, or if the folder your script is located in is writable by anyone other than yourself, the web server will not run the script; instead, it will display an "Internal server error" message.How to set permissions
You can usually set file permissions directly from your FTP software. Try right-clicking the filename on the server to get to a "Properties" option that displays read, write, and execute permissions.
You can also use the chmod command from the Unix shell.
Log in to the shell and issue the following command.
Replace "script.cgi" with the file name whose permissions you want to set.
chmod 700 script.cgi
