Help configuring Perl with Apache 2

C

Cyde Weys

BTW, as of now, index.pl is this:

#!/usr/bin/perl
print("Test\n");

Thanks everyone for all the help. Reading the error_log for apache was
indeed the key to solving this problem. I got an error message basically
saying, "Option ExecCGI isn't set in this directory." Apparently, the
/var/www/html directory was set to allow override none, so even though I
had blanket Options ExecCGI that wasn't being allowed. So in the
Directory definition for /var/www/html I included Options +ExecCGI ... and
immediately got another error (internal server configuration error).

The logs said the problem was due to bad headers. Well, DUH, I know how
to use CGI.pm. So I fixed up my .pl file and everything works now! If
you want to see my (very pathetic) website, you can check it out here:
http://terpy.student.umd.edu

Once again, thanks a lot to all you helpful guys out there.
 
C

Cyde Weys

This is more of an Apache question than a Perl question, but I'll go
for it here. I installed RedHat 9 (including Apache 2 and Perl) from
CD. Now, I'm trying to configure the webserver to execute perl scripts.
I have set the "Options ExecCGI" as well as the "AddHandler cgi-script
..pl" ... but when I try to load up index.pl, I get a "Forbidden access"
error message. I have chmod a+x the index.pl file. When I take out the
line "AddHandler cgi-script .pl", opening up index.pl just shows you the
contents of the .pl file. I don't see why I'm getting "forbidden" error
messages ... I do have the permissions set up to allow it to run. Also,
I've verified that the Perl file runs correctly from the www directory
with "./index.pl" ... any help would be greatly appreciated. Thanks.

BTW, as of now, index.pl is this:

#!/usr/bin/perl
print("Test\n");
 
C

Cyde Weys

John said:
Check out CGI.pm and read about "headers". Don't write CGI perl scripts
with your own homebrew CGI.

Okay, I know about CGI.pm ... I've used it before ... but are you saying
that becuase I'm not using correct Perl CGI I'm getting forbidden error
messages?
 
A

Alan J. Flavell

Okay, I know about CGI.pm ... I've used it before ...

It's a good choice, even if you know how to produce CGI responses
yourself. But feel free to learn what a CGI response looks like
anyway (hint: perlfaq9 has pointers, but such discussions are on-topic
for comp.infosystems.www.authoring.cgi rather than c.l.p.misc).

Also online at http://www.perldoc.com/perl5.8.0/pod/perlfaq9.html
but are you saying that becuase I'm not using correct Perl CGI I'm
getting forbidden error messages?

Having a problem parsing that. Oh, right - you said:

| I'm getting "forbidden" error messages

With respect, there _is_ a difference between "forbidden error
messages", and error messages which say "forbidden".

And there was no specifically "Perl" error in your wrong CGI response.
CGI stands for "common gateway interface": it isn't specific to Perl
or to any other individual programming language.

Well, your server configuration is wrong somehow. You need to inspect
the error log.

But anyway: your script's response (the one exhibited in your original
posting) was an invalid CGI response. What are you trying to achieve?
If you're just playing around to understand the CGI, then go right
ahead, but you need to refer to the spec or to some kind of tutorial
to understand what you're doing. But if you're trying to make
something that works in a real WWW context, then use CGI.pm.

Either way, you rate to get a dusty reception here if you ask purely
CGI-related questions.

good luck.
 
N

Nico Coetzee

Okay, I know about CGI.pm ... I've used it before ... but are you saying
that becuase I'm not using correct Perl CGI I'm getting forbidden error
messages?

You should at least send the content type header:

print "Content-type: text/html\n\n";
print "<html>....</html>";

Note the double '\n' after the header

Cheers

--
Nico Coetzee

http://www.itfirms.co.za/
http://za.pm.org/
http://forums.databasejournal.com/

To the systems programmer, users and applications serve only to provide a
test load.
 
C

Cyde Weys

Abigail said:
Then why you posting here?

*PLONK*

Because I believed this question was more likely to be answered in the
Perl newsgroup (which I was right about). I wasn't expecting to have to
deal with people like YOU.
 
C

Cyde Weys

Tad said:

Haha, it's kind of funny that I got two kinds of responses from the
people in this newsgroup: the very helpful, in-depth responses from
people such as john Bokma, Purl Gurl, and Alan J. Flavell; and the
simple *plonk* responses that really add nothing new to the newsgroup.
I ask you, Tad McClellan, and Abigail, exactly what do you think you are
contributing?
 
C

Cyde Weys

John said:
If CGI.pm defaults to XHTML I consider this a bit odd. Maybe even bad.

This does appear to be the case. I am simply doing "print header;" and
it is assuming I want to use XHTML (which I don't, I don't even know how
to use it). Does anyone know how to tell CGI.pm to use different
headers, i.e. HTML 4.1? Thanks.
 
T

Tony Curtis

This does appear to be the case. I am simply doing
"print header;" and it is assuming I want to use XHTML
(which I don't, I don't even know how to use it). Does
anyone know how to tell CGI.pm to use different headers,
i.e. HTML 4.1?

perldoc CGI ?

-no_xhtml ...

-dtd might also be of interest.

hth
t
 
V

Vlad Tepes

Cyde Weys said:
Haha, it's kind of funny that I got two kinds of responses from the
people in this newsgroup: the very helpful, in-depth responses from
people such as john Bokma, Purl Gurl, and Alan J. Flavell; and the
simple *plonk* responses that really add nothing new to the newsgroup.
I ask you, Tad McClellan, and Abigail, exactly what do you think you are
contributing?

Since you're now plonked by Tad and Abigail, you're not likely to get an
answer from them.

I can assure you they are both contributing. A lot. Being plonked by
them means you won't benefit from their expert knowledge in the future.

If you know your question belongs in another group, then don't post it
here. Doing so decreases the signal-to-noise ratio and makes the group
less useful for the rest of us.

Hope this helps,
 
G

Gunnar Hjalmarsson

John said:
I use XHTML currently on parts of my site, but am going to change
it (back) to HTML 4.01 strict.

If CGI.pm defaults to XHTML I consider this a bit odd. Maybe even
bad.

Why? at http://www.w3.org/MarkUp/ I read: "XHTML is the successor of
HTML, and a series of specifications has been developed for XHTML."

Defaulting to a more recent W3C recommendation does not appear odd or
bad to me. Even if I'm not a member of the CGI.pm fan club, this seems
not to be a proper base for criticizing the module.
 
V

Vlad Tepes

Gunnar Hjalmarsson said:
Why? at http://www.w3.org/MarkUp/ I read: "XHTML is the successor of
HTML, and a series of specifications has been developed for XHTML."

Defaulting to a more recent W3C recommendation does not appear odd or
bad to me. Even if I'm not a member of the CGI.pm fan club, this seems
not to be a proper base for criticizing the module.

Is it not so that one of the most used browsers have trouble with XHTML?
If this is the case, using XHTML as default could be a bad thing.
 
C

Cyde Weys

Vlad said:
Since you're now plonked by Tad and Abigail, you're not likely to get an
answer from them.

Yeah, I figure as much. I'm not stupid. But sometimes people only say
*plonk* just to show off or make a statement, but they never actually go
through with their threat.
If you know your question belongs in another group, then don't post it
here. Doing so decreases the signal-to-noise ratio and makes the group
less useful for the rest of us.

I should have phrased my question more carefully then. I didn't mean,
"I know this belongs in another group but I'll post it here just to
screw with you guys and lower the s/n ratio." I meant, "Perhaps this is
more applicable to an Apache newsgroup, but since the question deals
with how to configure Apache to work WITH PERL, I think I might get more
knowledgable responses here."
 
G

Gunnar Hjalmarsson

Vlad said:
Is it not so that one of the most used browsers have trouble with
XHTML? If this is the case, using XHTML as default could be a bad
thing.

I suppose it depends on the nature of the trouble. Btw, which browser
is it?
 
V

Vlad Tepes

Cyde Weys said:
Vlad Tepes wrote:

I should have phrased my question more carefully then. I didn't mean,
"I know this belongs in another group but I'll post it here just to
screw with you guys and lower the s/n ratio."
Good.

I meant, "Perhaps this is more applicable to an Apache newsgroup, but
since the question deals with how to configure Apache to work WITH
PERL, I think I might get more knowledgable responses here."

I'd like to inform you about these groups:

comp.infosystems.www.servers
comp.infosystems.www.authoring.cgi

Asking for help in the proper group is likely to give you the best
resonses.

Hope this helps,
 
G

Gunnar Hjalmarsson

John said:
Well, since XHTML assumes that browsers accept *invalid* HTML like:

<br />

for one. Also when you output XHTML you should send the proper headers.
I don't know if CGI.pm does this (i.e. text/html for a non-XML browser
but application/xml-something for an XML browser, have to look that up).
Also some browsers choke on the XML prolog, see:

http://www.webstandards.org/learn/reference/prolog_problems.html



To me it does. It used to output HTML, now it switches to XHTML
"suddenly". This happens under the hood. Which is bad. It means that the
output of your CGI script changes when you update CGI.pm... (or worse,
when your hosting provider does...)



See above. It means that an update of CGI.pm changes the output of CGI
scripts which is bad bad bad. Especially since CGI.pm belongs to the
core (IIRC). It means people have to update *all* their CGI scripts to
make it behave as it did in the past. Doesn't that strike you as
somewhat odd?
 
A

Alan J. Flavell

Yeah, I figure as much. I'm not stupid. But sometimes people only say
*plonk* just to show off or make a statement, but they never actually go
through with their threat.

When you find yourself down a hole, it's wise to stop digging. If you
didn't know beforehand that Tad and Abigail have their respective
reputations on this group, it's not hard to find out.
I should have phrased my question more carefully then. I didn't mean,
"I know this belongs in another group but I'll post it here just to
screw with you guys and lower the s/n ratio." I meant, "Perhaps this is
more applicable to an Apache newsgroup, but since the question deals
with how to configure Apache to work WITH PERL, I think I might get more
knowledgable responses here."

The knowledgeable responses that you got seemed to show that you have
two evident problems: one of them belongs on the c.i.w.servers.*
hierarchy as it relates to Apache configuration, and the other belongs
on the c.i.w.authoring.cgi group as it relates specifically to the
CGI. At no point did you exhibit anything that was a Perl problem
(you clearly have the ability to write a syntactically correct print
statement in Perl, just that what you printed wasn't useful for its
purpose). I initially gave you the benefit of the doubt, where others
evidently felt you had already gone too far with the discourteous way
you expressed your question.

You might not have known that before, but you better believe it now,
if you're to stand any hope of convincing the hon. Usenauts of your
claim that you're 'not stupid'.

best regards
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,137
Messages
2,570,795
Members
47,342
Latest member
eixataze

Latest Threads

Top