Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to test a cgi file

Status
Not open for further replies.

mheilbut

Programmer
Apr 24, 2002
53
BR
I have a sample of a cgi file that makes a simple hmtl form.
What must I do to execute it on my browser? Where do I have to install or move it to?
Thanx. Michel, São Paulo, Brazil
 
a piece of CGI code runs in a web server context.

In it's simplest form, a web server accepts an http request
for a document and either sends the requested document or an
error message. A web server might hand back a document that
looks like this.
Code:
<html><head><title>easy html></title></head>
<body>
<p>Hello, I'm a web page</p>
</body>
</html>

With CGI, the http request can ask the web
server to run a program and send back the output from the
program.

For instance, if I have a computer with the Apache web server running on it and a piece of CGI that looks like this.
Code:
#!/usr/local/bin/perl
print &quot;Content-type: html/text\n\n&quot;;
print &quot;<html><head><title>easy html></title></head>
    <body>
    <p>Hello, I'm a web page</p>
    </body>
    </html>&quot;;
That is trivial piece of CGI, but, you see that it is a program that produces output that looks like an html page.

So, to get your CGI code to run in your browser, you must first get it onto a web server that supports CGI and the language the CGI is written in. There are quite a few possible approaches.

Download and install apache.
or - on a M$ system, get PWS - a pain and weak but it will
work.
or - use one of the free or low cost hosting companies
or - see if your internet service provider will work.
They usually give you a little disk space, you might
can do it there.

My first choice, everytime, is to download and install apache on whatever system you are using. There is a faq in this forum about setting apache up to do cgi on a Win NT system that might help. Or, just see apache's documentation. They are very good.



'hope this helps

If you are new to Tek-Tips, please use descriptive titles, check the FAQs, and beware the evil typo.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top