Installing CGI-Scripts

vishal sharma's Avatar author of Installing CGI-Scripts
This is an article on Installing CGI-Scripts in Web Development.
For many new webmaster this is probably one of the most daunting tasks they'll need to do. Mainly because you're not used to the UNIX environment, but also because you have to edit some perl scripts to make the script work. Here are the basic things you need to install CGI-Scripts.

You need a web host that gives you a cgi-bin, most free hosting companies won't give you a cgi-bin because of security reasons. If you're on a free web host and you want to add things like a guestbook or message boards, I would suggest you use a service like www.bravenet.com they have codes that you just cut and paste. Good thing, it's easy, bad thing, it has advertising and it generally makes your page look a little less professional.

You'll need the script itself. You can download almost any cgi-script for free at www.cgi-resources.com this is where I go to get any scripts that I'll need for the websites I write.

You'll need a plain text editing program. If you're in a windows operating system Notepad would be fine to edit perl / cgi scripts. (Don't use Word, Wordpad or any other "rich text" type program, it will screw up the script).

You'll need an ftp program, this is a program that will upload your page to your server. I like WS_FTP Pro, you an use the lite version of this program, which is free, but this pro version offers more features and easier to use I think.

Okay, so that's what you'll need, now here is the important things you'll need to know about installing the scripts:

Always read the included installation instructions. All scripts come with a readme.txt file or some form of installation instructions. Read these carefully, because they'll tell you how and what you need to do for this script.

Knowing the perl path for your server. In all cgi scripts the script itself will need to know where the perl kernel is. In most cases the perl path is /usr/bin/perl and most people that write scripts will point it here, contact your web host if you're unsure of where the path to your perl kernel is

Make sure to upload the .cgi files to the cgi-bin on your server. Almost all the servers I've been on makes you upload your scripts to a separate folder called the cgi-bin. If you upload your script elsewhere it just won't work (note, on some servers they do allow you to put the cgi-scripts in any directory, but it's been my experience that most have the separate cgi-bin).

When uploading CGI, make sure that you upload it in ASCII, not BINARY, if you upload it in Binary the script will not work. Binary is for photos and regular pages, but for scripts you'll need to upload it in ASCII format.

Know the root to your cgi-bin and also the public_html files. Most of the times the path will look like /home/username/domain name/public_html and the root to your cgi-bin will look like /home/username/domain name/cgi-bin - Once again, you'll need to contact your web host if you're unsure. Also, some scripts will point to the cgi script by having the url and not the root, pay attention to what the script asks, because sometimes it will be the url where the script is located, like, http://www.yourdomain.com/cgi-bin/scriptname.cgi

Knowing your sendmail path. This is for scripts that will allow users to email or perhaps if the program emails you if someone posts messages etc. The send mail path is usually /usr/lib/sendmail once again, if you don't know contact your web host or check their FAQ, they usually give this information there.

Knowing how to chmod or set permissions to files and directories. All the scripts you download will tell you to set permissions to your scripts and files, you must do this! If they say to set the permission to a certain number, you must do so! If you don't, the script won't work! In the different ftp programs there are different ways to set permissions, usually most will have where you can right click on the file and there will be a permissions button or a chmod button and then you can set the permissions that way.

Contact your web host if you have trouble...always remember that you're paying for a service and most places offer technical support, don't be too shy to ask for help, that's what technical support is there for and especially if you're paying for the service you should use the service as much as you can!

These are the basics you need to know, each script is different, some programmers really go out of their way to make the script easy to install, some programmers write great scripts but give lousy instructions, so, just try out some scripts, don't be scared of them, and don't give up on them, because the first few times, you'll almost always get errors, trust me, I should know!

One other thing, I found with my own webhosting company that they weren't that willing to give cgi help, I think that's sort of lame to tell you the truth. A company that offers services should be knowledgeable on such topics, but you often find tech support usually knows less than you and that you're on your own most of the times.

I've installed lots of scripts now and there are a few that I'll use over and over again because they're just so easy to install and really work great. If you want some help in this area I can point you to the easiest to install cgi-scripts, just tell me what your looking for or I'll write a tutorial on what scripts to use. Have fun, don't get frustrated, and don't give up, you'll get the hang of the cgi-scripts soon enough ) If not, email me and I'll try and help out.
0
alok's Avatar
Ambitious contributor
sorry to Disturb you in this matter :d
but i think the CGI is now obesolute technology,every buddy is going after new technology like JSP and ASp which more Fast and efficient.
sorry ,but that truth,it that hurt i am sorry.
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Sorry Alok but cgi is not at all obsolete and lots of technology still uses cgi. Perl is the most exciting language for cgi and still in development phase its use is increasing day by day.

Thanks
Shabbir Bhimani
0
alok's Avatar
Ambitious contributor
may be you are rite
but with all due respect,no buddy want to use it when same functionality is provided by more powerful and easy scripting lanaguge like ASP ,PHP( which is upgrade of perl) and JSP.
may be it on developmental stage,but why to develop a thing which already obesolute
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Alok, now I think you are not very much unknown to web technology.

» PHP( which is upgrade of perl)
First PHP and perl are nowhere related

JSP can be considered as an easy way to use Java on web.

Now if you say
» but with all due respect,no buddy want to use it when same functionality is provided by more powerful and easy scripting lanaguge like ASP ,PHP( which is upgrade of perl) and JSP.

so now the question comes why there are 3 scripting languages and not one say APJ(ASP,PHP,JSP). All can provide same functionality and to be honest all cannot have the same ranks if we define them with no1, no2, no3.

Now if its on development and you are critising perl then this means that perl is famous and not obsolete.
Windows is attacked by virus but not linux. What does it mean that non windows lovers want to give trouble to win guys but they think to keep linux clean but microsoft can develop virused for linux if they want but knows that Linux is nowhere near win and so doesnot need it.

Alok if this hurts please dont mind.

Thanks
Shabbir Bhimani
0
alok's Avatar
Ambitious contributor
YEah i am new to webtechnology,the only weblanaguge i know is HTML
Basically i quoted wrong that PHP is Upgrade of perl. actaully they are syntacally same.
and abotu perl really my knowledge is zero do you have any good article that support that perl is lanaguage of future.
basically Web is not my line i am vc++ Programmer and i work as System programmer in small company and trust my word my level is that of beginner
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Benjamin78, your hosting url is self promotion without the context of the article and is deleted.
0
rapwaydown's Avatar
Contributor
wow, im new to web technology, still dont know HTML very good
but getting there
0
ashleycameron's Avatar
Newbie Member
Hi, This is awesome article. Its very interesting and informative, Where you read this topic. Its really great work. Try to post these kind of article often... Best of Luck.
0
Jenniferlinn's Avatar
Go4Expert Member
Hello vishal

Thanks for posting such a useful article here, It clears most of my doubts about the topic