On Wed, 3 Oct 2001, Richard Marriott wrote:

> If anyone could please lend a hand..
> I am working on a simple site with a WHOIS 
> search in it.. the address of which is..
> 
> http://www.trust2host.com/fhwhois.htm
> 
> As you use the search it comes back with 
> the code... What am i doing wrong....
 
I went to the page & it tried to send me to here:

<http://www.trust2host.com/fhwhois.pl?domain=yahoo&extension=.com> 

That page, rather than sendind the result of the script, tried to send me
the script itself. This is a sign that your server isn't parsing cgi
scripts as if they're executable. There are two ways around this: 

  * one is to put all perl (python, shell, batch, whatever) scripts
    into one folder, typicalled /cgi-bin, and bless the contents of
    that folder appropriately. 

  * the other way is to have your server parse them according to
    extension, much like Windows and other systems do with file
    name extensions -- .htm files are html, .txt files are plain
    text, and .pl files are perl scripts.

Which you go with is your call. Some people have pretty strong preferences
(/cgi-bin is seen as being better for security, but I think it's kind of a
pain in the butt), but whatever. Doesn't matter.

I see that you're running Apache/1.3.12. This is a slightly old version
(current is around 1.3.20), but should be okay. Wherever your Apache is
installed -- often /usr/local/apache, though sometimes -- like with Red
Hat's builtin version -- it can be elsewhere. Inside the Apache base
directory will be a subdirectory called /conf, and in it will be a file
called httpd.conf. This file typically controls all of the main server
settings. If this file is basically as it came by default, you can search
within it for the AddHandler section. Comment lines, as with perl, start
with a pound sign. You may already have a line like this:

   AddHandler cgi-script .pl

or 

   # AddHandler cgi-script .pl

If it's there & commented, and you want cgi-scripts to be executed by
extension, then uncomment it. You can add multiple extensions to this
directive by the way, so you can put something like

   AddHandler cgi-script .pl .py .cgi 

and perl, python, and generic cgi scripts will all be executed by type.

If you'd rather go by directory, then you need to have a block of
instructions something like this:

   ScriptAlias /cgi-bin/ "/path/to/your/cgi-bin/"

   <Directory "/path/to/your/cgi-bin">
       AllowOverride None
       Options ExecCGI
       Order allow,deny
       Allow from all
   </Directory>

Anything inside your filesystem's /path/to/your/cgi-bin directory -- which
is visible through your web server as www.trust2host.com/cgi-bin (see how
the scriptalias directive translates that?) -- gets executed. 

Once you have the server set up, then the script should be callable
directly from the web browser as, say, 

<http://www.trust2host.com/fhwhois.pl?domain=yahoo&extension=.com> 

or

<http://www.trust2host.com/cgi-bin/fhwhois.pl?domain=yahoo&extension=.com> 

and if that works, then you can edit the html page that points to it
(correct the href attribute of your <form> element) and you're done. 

If this was along the lines of what you needed, and it worked, good. If
you still need help, let the list know...



-- 
Chris Devers                     [EMAIL PROTECTED]

_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/activeperl
  • beginer Richard Marriott
    • Chris Devers

Reply via email to