|
|
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.
This help section provides you with information needed when configuring scripts and other information regarding your CGI-bin.
Where to put cgi scripts
Put your cgi-bin scripts in the directory named "cgi-bin".
Important paths
Here are your paths to the common server resources that CGI scripts often require:
Date: /bin/date
Sendmail: /usr/lib/sendmail
Perl5: #!/usr/bin/perl
Root path: /home/username/
(puts you in your the root of your account)
Web directory: /home/username/public_html/
(puts you in your httpdocs directory)
Cgi-bin path: /home/username/public_html/cgi-bin/
(puts you in your cgi-bin)
Setting Permissions Using FTP (SmartFTP Guide)
Once you have sucessfully logged into the FTP Server, navigate to the file(s) you want to set permissions to. Right click the file(s) and select CHMOD. You can then specify what permissions to set.
(Refer to the permission definitions for an explanation of settings.)
Permissons definitions
Owner = the files users (you)
Group = the files group
Others = others Permissions Definitions
r = read access
x = execute access
w = write access
Numerical Definitions:
r = 4
x = 2
w = 1
You will come to recognize, if you do not already, Chmod as a word used for changing Permissions from within your FTP client. Some scripts will tell you to chmod 775 (for example). When using the numeric system, the code for permissions is as follows:
4 + 2 + 1 (rwx) = 7
The first number applies to Owner, the second number applies to Group, and the third number applies to Others. Therefore the first 7 of the chmod 775 tells Unix to change the Owner's permissions to rxw (because r=4 + w=2 + x=1 adds up to 7, this giving the Owner Read, Write, and Execute Permission. The second 7 applies to the group, this giving the Group Read, Write, and Execute Permission, and the last number 5, refers to Others (4 + 1= 5), giving Others only Read and Execute Permission. The permissions for chmod 775 look like this: rwx rwx -rx.
Permissions are always broken up into three groups of letters, however if there is a dash, this dash simply means that Permission wasn't given for that particular function. For example, in the chmod 775, Permission to Write was not given to Others. Remember: the first 3 letters always apply to Owner, the second 3 apply to Group, and the third 3 apply to Others.
Cgi Errors
Below are solutions to some of the more common CGI script problems.
When I activate my CGI program, I get back a page that says Internal server error. The server encountered an internal error or mis-configuration and was unable to complete your request.
This is generally caused by a problem within the script. Check your script settings again to see that you have entered the correct server information and have set the correct permissions for the script. If this information is correct, you'll need to contact whoever wrote or is distributing the script for further assistance.
I am being told "File Not Found," or "No Such File or Directory."
Upload your Perl or CGI scripts in ASCII mode, not binary mode.
My script doesn't work
Writing scripts can be a complex and time consuming process.
Burton Hosting does not offer any free support for building your scripts. Please try asking members of our Support Forum for help, and they may be able to guide you.
|