CGI
Introduction
Common Gateway Interface. These are usually quite small ( though not always ! ) programs that can be run from the browser. Basically you upload a CGI script to the server then when someone views a page on your site it ' calls ' this script which is then run in the viewers browser. They can be used for many different purposes.
What are the ' Paths ' on my server?
Most CGI scripts require you to enter some details about the server and how it is configured, this should be all the information you need :
Perl 5 is installed and the path is : #!/usr/bin/perl
The base path to your Web directory is : /home/sites/www.yoursite.com/web
The path to sendmail program is : /usr/sbin/sendmail
What is CHMOD or setting permissions?
OK, when someone views one of your websites pages which calls a CGI script the they have to have permission to use that file.
Linux / Unix has 3 settings for the type of user and three settings for the permission of that user.
- Owner This is the person that uploaded the file
- Group If you have used the ' add user ' in your siteadmin then everyone her is considered part of the group.
- Other Not surprisingly this means everyone else.
You can set each of these to have certain permissions for a file
- Read They can read the file, IE just view it
- Write They can write to the file, IE add to it or edit it.
- Execute They can run the file.
To set permissions in most FTP programs you right click on the file which brings up a list of commands. Select CHMOD
I've got the idea of CHMOD but what do the numbers mean?
You will find quite often that you are told to CHMOD 755 a CGI file, this is what it means :
Each of the above permissions is given a value :
Read = 4
Write = 2
Execute = 1
In the example we have CHMOD 755
The first digit refers to the owners permission :
Read, Write and Execute = 4+2+1 = 7
The second digit is for the groups permission :
Read and Execute = 4+1 = 5
The third digit is for everyone else :
Read and Execute = 4+1 = 5
How should I upload and download CGI scripts?
Your FTP program should give you a couple of options on how to handle files. these are usually Binary or ASCII ... sometimes they throw in Automatic as well :o)
Whenever dealing with CGI scripts ALWAYS use ASCII otherwise the scripts could become corrupt and not work.
How do I edit a CGI script?
Once you have the script on your computer just open it up with a basic text editor, avoid more complicated programs like Word and just stick to something like notepad.
Should I use .pl or .cgi extensions to a CGI script?
On our servers you can use either.
Where should I put the CGI scripts?
Once you have logged into your account with FTP you will see a cgi-bin in your web directory ... all scripts should be uploaded to here.
Please review our Terms and Conditions.
Copyright © 2000-2010 OriWeb, LLC and its licensors. All rights reserved.
|