| |
Preperation for Installation
Create a process check list befor starting
instalation. This will be useful even for your future script installations.
Read further to create a checklist.
You can either use telnet or any FTP program for uploading or downloading
a file to your server. I use WS_FTP from IPSwitch.com.
If you are a beginner, you can use their free version of FTP software
and you can make your work much easier.
You need to identify your server and web server
types. If you are working under UNIX or LINUX and your web server
is apache you can start with out any prior preparations, But if
you are working under Windows NT or 2000 servers and your web server
is IIS then you have to install Active
Perl(www.activeperl.com) first. Then you can proceed with the
following steps.
1. Find the location of the Perl program in your UNIX server - This
is the path of the Perl interpreter in you server. You can get this
information by either telnet your server (if you have the access
to telnet your server because some servers don't allow you to use
this facility) or by asking your system administrator or your hosting
companiy's support. For example it may be something like,
| # ! /usr/local/bin/perl or # ! /usr/bin/perl5
|
This is depend on the Perl version installed and
location where it has been installed.
If you have telnet access you can type the following and you will
find the path,
You don't have to worry about the above if you
are server is Windows.
2. The server path (or root directory path) to your CGI-bin directory.
Remember this is not the URL of your CGI-bin directory, but this
is the path of the the cgi-bin directory in your server. Your server
administrator should tell you this if they allotted a CGI-bin directory
with full access. This may look like
3. The URL of the cgi-bin directory - I know you
are aware of this, you can get this also from these same people.
This may be like
| http://www.domainname.com/cgi-bin/ |
Now I hope you know the difference between a "Root
directory path" and a URL from the two path names above.
4. Path of the sendmail program - This will be
used by the scripts which are sending any input information from
your site to the users or to you by E-mail. For example, a feedback
form uses the 'sendmail' program to send the details (which was
filled up and sent by the user) to your mail box. This could be
like,
| /usr/sbin/sendmail or /usr/lib/sendmail or
/usr/bin/senmail |
If you are in windows you have to give your SMTP details of your
mail server. This could be something similar to smtp.domainname.com.
If you don't have any of these information you can ask your ISP
or the web hosting support people and collect it.
Start installation now!
Open the readme file in a text editor and start reading it carefully.
Almost all the scripts will come with a readme.txt or install.txt.
Make sure you have the complete list of files that have to be installed.
You can find it in the list of files from the Help Text file. (Mostly,
script developers do this documentation to help you locate the missing
files). If your download was successfully done without any interruption,
you probably have all the files needed for installation. Let's learn
how to use any script file with these 5 easy steps.
1. Follow the installation document. You will be asked to open a
.cgi or .pl file in a text editor( I prefer WordPad) as the first
step. In almost any file of this type, you could find the something
similar to the following,
This line should be in your Perl script as the
first one. It often causes a "500
Internal Server Error", if this is not set as your first
line or if it is set in the wrong place. Copy the path of Perl program
in your server noted down during the previous lesson as the first
line of your program, with' # !' in the front. Should this command
fail, ask your system administrator if they have Perl installed
on their server and to where you should point this line.
2. Keep reading the .cgi or .PL file, you'll find some lines telling
about the directory path and URL settings of your cgi-bin directory.
Change the cgi-bin path in this file to the one noted down. Follow
the other instructions in the script file given as Remarks. (All
the lines which you find that start with # symbol are remarks or
comment statements) Sometimes the author gives you a warning like
"You should not edit anything below this". Its
advisable to follow these warnings. Then, you may be asked to open
some more script files to do the same settings as above. Go one
step at a time carefully. It is easily done. Let us pause for a
moment here and learn a little more about the cgi-bin.
The cgi-bin is a special directory in the server where we keep all
the files, which require security. Limited access of CGI scripts
to trusted users is necessary, since the CGI opens up a lot of security
risks. Therefore, most web platforms only allow files inside of
a cgi-bin to be executed. This can be changed. If the cgi-bin has
not been enabled on your server, or if you don't have one, ask your
system administrator to give you the privilege to execute CGI scripts
on your server.
A cgi-bin is needed to run these scripts unless your system administrator
has turned on ExecCGI, which enables .cgi extensions to be used
in any directory. To find out if you can use CGI scripts, your best
bet is to ask your system administrator if you can. He/She may opt
to give you a cgi-bin in your directory, turn on ExecCGI or check
your script and then place it in the server cgi-bin.
Just make sure you set all variables to reflect any changes you
have to make to the location of files and scripts by double-checking.
3. Now you are ready to upload. You can upload all the files after
completing all necessary changes There are two modes of uploading,
ASCII and Binary. You can upload the .cgi, pl, .config, .cfg, .setup
and .txt files in ASCII mode, because basically they are text. Upload
any image files like .jpg or .gif in Binary mode. If you don't follow
this you will not be able to execute the script. If you upload any
script files in Binary mode it will crash the script too. If you
find that you have done it accidentally, delete the server file
and upload a fresh copy from your local hard drive, carefully this
time!
4. Now you would like to change the permissions of the script files
but first you need to know that this is place where people often
make mistakes and fail in installing scripts. You should be clear
about chmod (changing mode or permission), so don't skip this area.
File permissions allow read, write, and execute access to users
based on their user identification (also known as uid), and their
membership to certain groups. You can use the command: chmod to
change a file's permissions. Here is an example:
Chmod is a UNIX command which changes the security
settings for a particular file, giving users and groups permission
to read, write, and/or execute certain files.
For the script files, you need to make them executable. The code
for that is 755. You only need to do this once. When you FTP the
file again, it will overwrite the old file but the permissions will
stay the same. Also note that some FTP software (like WS_FTP) have
a builtin option to let you change the permissions without having
to telnet to the server. Your server however has to support that
feature. If you are interested in setting permissions from your
FTP program, keep reading this section for more information on exactly
what the permissions numbers (755 or 666) mean; or you can jump
ahead to step 5, if you are not curious.
After you chmod the file, type in ls -ls (that's ls[space][dash]ls)
and it will show a directory listing. In WS_FTP you can view it
by pressing the Refresh and DirInfo buttons. Notice that next to
the .cgi files, there is something that looks like:
For our purposes, we can ignore the first symbol
-. The "r" symbol stands for read. The "w" symbols
stand for write. And the "x" symbols stand for execute.
Now, the above line of symbols is actually divided into 3 categories.
(Ignoring the first symbol as stated above) the first three symbols
define the permissions for the file's user (probably you). The second
set of three symbols define the permissions for the file's group.
(If you and many other employees are working on a web project together,
you might be set up on the server as a group so you can edit each
other's work). The third set defines the permissions for everyone
else ("others" or the "universe"). So by doing
chmod 755 filename.cgi, you or your group can read, write, and execute
the file. Everyone including the Internet browsers, can read and
execute the file.
So what does the number 755 stand for? Notice that this has 3 digits.
As you would expect, those 3 digits correspond to the three different
sets of permissions (file's owner, file's group, and others). Here
are what each individual digit stands for:
| 1 = - - x2 = - w - 3 = - w x 4 = r - - 5
= r - x6 = r w -7 = r w x |
Therefore: 755 = r w x r - x r - x (We don't have
to bother about the leading character). For more about chmod visit
here.
5.
After you have the permissions set, jump over to your browser and
try to run the script. Your installation help file will tell you
which URL you need to open. It could be a .cgi, PL or a .aspl file.
Now of course, according to Murphy's Law there will inevitably be
some kind of internal server error. Don't panic. That just means
that something (hopefully minor) is wrong with how the script is
set up. You need to double check once again from the beginning and
here is a checklist that can help you.
· CGI scripts root directory path
and URLs - Make sure its correct
· ASCII or Binary ? Which mode did you upload?
· Permissions of the script files, directory you created
and other text files.
· Location of the files you uploaded.[Script files -
Inside cgi-bin.Others probably outside]
· Did you miss any files?
· Make changes in all of them?
· Finish all the instruction in the list from your installation
help file ?
· Some scripts are using SSIs.(Egs Poll/Vote scripts).If
you run any Server Side Include(SSI) make sure your server is
enabled with this facility. |
After checking all of the above, when you
run the script, did you get something other than the error message?
Good! You are lucky this time and you can start working. Oh! somebody
is saying that they haven't succeeded there. I really want to help
you too.
We can pinpoint the problem from the type
of error messages the browser gives. After submitting the entry
via the form or opening the script file in the brower you may see
an error message. Let us diagnose the problem, correct the script
and, next time, let us stop the browser from screaming.
10. Learn from Errors!
11. How can I help you?
|
|