RE: CGI Question

by "Wiswell, Virginia" <Virginia.Wiswell(at)dowjones.com>

 Date:  Wed, 17 Jan 2001 09:33:31 -0500
 To:  "'BenLRead(at)aol.com'" <BenLRead(at)aol.com>,
hwg-servers(at)hwg.org
  todo: View Thread, Original
in a url, you have to use the exact file name under which you stored the
script. so http://localhost/cgi-bin/test.pl is correct if the script is
called test.pl. when you get a server error it means that it found the
script but there's a problem executing it. you might want to check the
syntax (it looks ok to me, though). you should do this for every script
before you put it in the cgi-bin directory. to do this, open a dos window
and type in: perl -c path\to\test.pl. the output will be error messages or
"syntax ok". sometimes you need to put an "exit 0;" at the end of a script.
you might try that too. i don't normally use CGI.pm because it's got huge
overhead, but it will work just fine.

let me know if you have more questions.

virginia

> -----Original Message-----
> From: BenLRead(at)aol.com [mailto:BenLRead(at)aol.com]
> Sent: Tuesday, January 16, 2001 6:44 PM
> To: hwg-servers(at)hwg.org
> Subject: CGI Question
> 
> 
> I'm sorry if you've already received my query about this and 
> replyed, but I 
> subsribed to the list after putting my question in so I fear 
> I might have 
> missed a responce!
> 
> I've recently bought a CGI book and am trying to teach myself.  They
> recommended I download the Apache webserver from 
> www.apache.org/httpd.html
> and a perl interpreter from www.activestate.com, which I've done.
> 
> I then wrote the following Perl program in a text editor:
> 
> #!c:\perl\bin\perl.exe
> 
> use CGI;
> 
> $query = new CGI;
> 
> print $query->header;
> 
> print "<head><title>A test</title></head>\n";
> print "The test was successful.";
> 
> I saved it as test.pl and placed it in the cgi-bin directory 
> of my web server.
> 
> The book then tells me in order to request the file with my 
> Web browser
> (which is Internet Explorer 5) I am to use the following URL:
> http://localhost/cgi-bin/test.cgi
> 
> I then get a page come up saying 'file not found', so then I 
> tried the same
> URL but using test.pl instead and it comes up with 'server error'.
> 
> I guess that my server is not set up for running cgi 
> programs, could you
> please tell me how I do this?  I'm trying to run it on a PC 
> with Windows 98
> operating system.  Please help!
> 
> Thanks very much in advance,
> 
> Ben Read.
> 

HWG: hwg-servers mailing list archives, maintained by Webmasters @ IWA

This page is part of a preserved archive of archives.hwg.org. The site is no longer active and its content is not maintained. For enquiries about this archive, write to archive(at)iwanet.org.