Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

setting up perl to work with appache

by rebot (Initiate)
on Mar 11, 2004 at 05:44 UTC ( #335725=perlquestion: print w/replies, xml ) Need Help??
rebot has asked for the wisdom of the Perl Monks concerning the following question:

I recently installed perl from and installed apache 2.0.48. Everything seems to have installed okay.
I am, however, having difficulty trying to run a test cgi script.
Can you tell me how to set up the localhost portion of the url?
For example: http://localhost/cgi-bin/test.cgi
How do I create or configure the localhost portion of that url?
I would like to test my scripts on my own machine/server before uploading them to a remote server (hosting provider).
Any suggestions on how to configure the localhost portion of the url?

Replies are listed 'Best First'.
Re: setting up perl to work with appache
by neniro (Priest) on Mar 11, 2004 at 06:07 UTC
    If you're using apache on windows you have to put your .cgi-files in the folder C:\Programs\Apache Group\Apache2\cgi-bin. Use the following header (with your install path) in your .cgi's and it should work:
Re: setting up perl to work with appache
by AcidHawk (Vicar) on Mar 11, 2004 at 07:15 UTC
    See my comments at Re: setting up a localhost for info on the localhost part.
    Of all the things I've lost in my life, its my mind I miss the most.
      I still wasn't able to get my localhost to work. Here's the cgi script I'm trying to run:
      #!C:\perl\bin\perl.exe -wT use strict; use CGI; my $query = new CGI; print $query->header( "text/html" ); print <<END_HERE; <html> <head> <title>My First CGI Script</title> </head> <body bgcolor="#FFFFCC"> <h1>This is a pretty lame Web page</h1> <p>Who is this Ovid guy, anyway?</p> </body> </html> END_HERE # must have a line after "END_HERE" or Perl won't recognize # the token
      And here is how my configuration file httpd.conf is set up:
      # # ServerName gives the name and port that the server uses to identify +itself. # This can often be determined automatically, but we recommend you spe +cify # it explicitly to prevent problems during startup. # # If this is not set to valid DNS name for your host, server-generated # redirections will not work. See also the UseCanonicalName directive +. # # If your host doesn't have a registered DNS name, enter its IP addres +s here. # You will have to access it by its address anyway, and this will make + # redirections work in a sensible way. # # # ServerName
      my script alias is also set up the following way:
      # ScriptAlias: This controls which directories contain server scripts. # ScriptAliases are essentially the same as Aliases, except that # documents in the realname directory are treated as applications and # run by the server when requested rather than as documents sent to th +e client. # The same rules about trailing "/" apply to ScriptAlias directives as + to # Alias. # ScriptAlias /cgi-bin/ "C:/Program Files/Apache Group/Apache2/cgi-bin/" # # "C:/Program Files/Apache Group/Apache2/cgi-bin" should be changed to + whatever your ScriptAliased # CGI directory exists, if you have that configured. # <Directory "C:/Program Files/Apache Group/Apache2/cgi-bin"> AllowOverride None Options None Order allow,deny Allow from all </Directory>
      I am trying to use to access and run this script. When I type the following script into the browser nothing happens and the browser keeps running and trying to load the page (acts like an infinate loop): thank you for your suggestion. I just can't get it to work. Does the fact that I'm also using ZoneAlarm and a hub make any difference? I don't know.
        I cut and pasted your cgi and put it into my cgi-bin dir and added a link to my test page and it worked fine. So there is no problem with your cgi (Other than the message I get that it is too late for -T). Also your httpd.conf settings look fine.

        You mentioned that you are using a hub..? Are you connecting to the url from the local machine or across a network..? Also Turn ZoneAlarm off for a bit while you are testing..?

        Let us know what happens..

        Of all the things I've lost in my life, its my mind I miss the most.
Re: setting up perl to work with appache
by BUU (Prior) on Mar 11, 2004 at 07:51 UTC
    A different solution. If localhost isn't working, just use, as that address always point to your own computer.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://335725]
Approved by ehdonhon
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (11)
As of 2017-06-26 10:57 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (577 votes). Check out past polls.