Re: Help getting Perl/CGI running on OS X localhost with apache
- From: John Bokma <john@xxxxxxxxxxxxxxx>
- Date: 10 May 2005 18:32:16 GMT
wrote:
> Hi John,
>
> Thanks for the reply. Unfortunately it went over my head. Could you
> clarify a few points
>
>>> The only difference from that webpage is my configure file will
> parse
>>> ".shtml" files instead of ".html" files.
>
>>shtml = SSI, not CGI
>
> Will this affect my first.cgi test since i am directing my browser to
> the actual cgi file? So what should I do?
..shtml is parsed HTML, you can call a script using SSI directives.
cgi is more commonly used like:
http://example.com/cgi-bin/helloworld.cgi
>>> I have written a file called "first.cgi" and saved it in my sites
> folder.
>
>>Use a cgi-bin dir *outside* your document root.
>
> My sites folder is "/users/peter/Sites". What should the cgi-bin
> directory be?
if you put index.html in Sites, and you see the index.html if you go to
http://localhost/ your document root is /users/peter/Sites. More safe:
search in your httpd.conf for DocumentRoot and check its value.
> I cannot understand what you complete first.cgi file would be with the
> modifications you have suggested.
/usr/bin/perl -T
use strict;
use warnings;
print <<HELLO;
Content-type: text/plain
Hello, World!
HELLO
(untested)
> I have seen other hello world files
> like mine suggested on the internet. I'm surprised that you seem to
> say it is not even close to correct.
This holds for an amazing number of CGI scripts you will find. Most will
be extremely badly written. A huge number are developed using trial and
error, which often means: find a script, change lines until it works,
make it available. In short, most scripts you find are insecure, garbage
and an extremely bad start for anyone wanting to learn CGI.
> I do not understand "make a cgi-bin directory in the *parent* of your
> Document Root, e.g....". Where would cgi-bin and htdocs be in relation
> to "/users/peter/Sites"?
/users/peter/cgi-bin
> Sorry, I guess I need a bit more hand holding to get started. But I am
> really interested.
Normally Apache set up questions should be asked in an Apache related
group.
Oh, and cgi-bin should be readable by your Apache process. 711 often
does the trick. If you can turn one 1 into 0, do so. (Same for the 5 in
755, if you can turn a 5 in a 0 do so).
--
John Small Perl scripts: http://johnbokma.com/perl/
Perl programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
.
- References:
- Help getting Perl/CGI running on OS X localhost with apache
- From: petermichaux
- Re: Help getting Perl/CGI running on OS X localhost with apache
- From: John Bokma
- Re: Help getting Perl/CGI running on OS X localhost with apache
- From: petermichaux
- Help getting Perl/CGI running on OS X localhost with apache
- Prev by Date: Re: eval statement in PERL
- Next by Date: Re: auto directorie ?
- Previous by thread: Re: Help getting Perl/CGI running on OS X localhost with apache
- Next by thread: Re: Help getting Perl/CGI running on OS X localhost with apache
- Index(es):
Relevant Pages
|