Help configuring Perl with Apache 2

G

Gunnar Hjalmarsson

[sorry for my previous post - pushed the Send button by mistake. :( ]

John said:
To me it does. It used to output HTML, now it switches to XHTML
"suddenly". This happens under the hood.

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?

I see your point, but it rather strikes me as a natural consequence of
using a module in such a dynamic area as generating HTML. (Personally
I don't do that.)

What would the alternative be? Never change anything, even if 'the
outside world' changes?
 
G

Gunnar Hjalmarsson

John said:
Gunnar said:
I see your point, but it rather strikes me as a natural
consequence of using a module in such a dynamic area as
generating HTML. (Personally I don't do that.)

What would the alternative be? Never change anything, even if
'the outside world' changes?

There are two possibilities:

[1] stick to HTML unless told otherwise
[2] adapt to what is hot

The problem is that [2] changes the output of scripts each time
CGI.pm has a new idea of what is "hot".

Since there are some problems related with XHTML I don't think
switching to XHTML is such a good idea at the moment, especially
since HTML is still supported and probably will be supported for
the next several years by most if not all browsers.

I can understand that you question the _timing_ for the change,
especially after having studied the documents you and Vlad pointed us
to. (Thanks for those links!)
Basically it means when somewhere a hosting provider updates CGI.pm
a customer of mine can get unexpected output from his script which
can make browsers of his customers behave odd...

To me that appears as an unavoidable problem - sooner or later.
Possibility [1] would of course be an option for the time being.
 
A

Alan J. Flavell

There are two possibilities:

[1] stick to HTML unless told otherwise
[2] adapt to what is hot

The problem is that [2] changes the output of scripts each time CGI.pm
has a new idea of what is "hot".

Since there are some problems related with XHTML I don't think switching
to XHTML is such a good idea at the moment,

Neither do I, as it happens; but I'm not sure that was so evident at
the time the change was made to CGI.pm. L.S was clearly relying on
the so-called Appendix C compatibility - which I rate as a mistake,
but that's not to impute that there wasn't an honest intention behind
it.
especially since HTML is still supported

Well, that rather depends on what you understand "HTML" to be. The
W3C's specifications are self-contraditory, as they on the one hand
define HTML to be an application of SGML, while on the other hand
outlawing things which SGML doesn't allow to be outlawed.
and probably will be supported for the next several years by most if
not all browsers.

It's pretty clear that the key features of XML (specifically:
declaring erroneous content to be unusable and quitting) will never be
"supported" by browsers. The merchants of tag-soup couldn't allow it.
So the choice is between HTML-flavoured tag soup, which was the
problem that XML was aimed to solve; or quasi-XHTML-flavoured tag
soup, which brings us the worst of both worlds.

But at the time that CGI.pm made the change, this might not have been
so evident ;-}
Basically it means when somewhere a hosting provider updates CGI.pm a
customer of mine can get unexpected output from his script

Well, I don't think that old versions of CGI would mind if you told
them not to generate XHTML. Then you'd be all set for an update.

In an ideal world, it might not have happened that way, but the CGI.pm
change to XHTML isn't exactly new - you appear to be fighting last
year's battles, to be fran^W honest.

all the best
 
G

Gunnar Hjalmarsson

John said:
... even [2] say in 2005 means it will going to change the output
of scripts. It changes the output without the programmer doing
anything.

Unless you - by then - have modified the scripts to output XHTML. :)
 
J

James Willmore

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.

In the future, please post to the appropriate newsgroup. Although you
_may_ be running a Perl script, this issue has to do with the proper
configuration of Apache.

To be helpful (because you seem to think your right to post in the
newsgroup and I don't feel like arguing with you about this point),
the issue lies with the _directory_ you have as your cgi-bin.

Try 'chomd -Rv 755 <your cgi-bin directory>'.

Again, this issue lies with your configuration of Apache, _not_ with
Perl.

HTH and Have a nice day!

--
Jim

Copyright notice: all code written by the author in this post is
released under the GPL. http://www.gnu.org/licenses/gpl.txt
for more information.

a fortune quote ...
There are three things I always forget. Names, faces -- the
third I can't remember. -- Italo Svevo
--
Jim

Copyright notice: all code written by the author in this post is
released under the GPL. http://www.gnu.org/licenses/gpl.txt
for more information.

a fortune quote ...
As Zeus said to Narcissus, "Watch yourself."
 
J

James Willmore

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.

Yes.
perldoc CGI

And, while you're at it, you should research the various RFC's and
FAQ's available
http://www.w3c.com/

And, I take it you're a college student, yes?
Read, read, read. Learn, learn, learn.
There's lots of material out there to aid you - take advantage of this
fact.

HTH

--
Jim

Copyright notice: all code written by the author in this post is
released under the GPL. http://www.gnu.org/licenses/gpl.txt
for more information.

a fortune quote ...
We can defeat gravity. The problem is the paperwork involved.
 
C

Cyde Weys

James said:
Yes.
perldoc CGI

Hehe, someone had said that to me before, but I didn't know what they
were talking about. I didn't realize it was literally a command you
could type into the command line.

Anyway, I didn't use perldoc because I wanted something searchable. So
I looked for the Perl CGI.pm manual online - which I found - and came up
with the following gem:



-no_xhtml
By default, CGI.pm versions 2.69 and higher emit XHTML
(http://www.w3.org/TR/xhtml1/). The -no_xhtml pragma disables this
feature. Thanks to Michalis Kabrianis <[email protected]> for this
feature.

I don't know what a pragma is, but by following the examples, I was able
to work it into my program and now I'm using HTML 4! Also, it got rid
of the annoying slashes after text problem (ie <br /> instead of just
And, while you're at it, you should research the various RFC's and
FAQ's available
http://www.w3c.com/

And, I take it you're a college student, yes?
Yes.

Read, read, read. Learn, learn, learn.

"Read" is only one of the many steps of the "learning" process. There's
also "ask" and "listen".

Also, I forgot my Perl book at home --- GRRRRRRR. I'm having my parents
ship it to me.
There's lots of material out there to aid you - take advantage of this
fact.

Thanks for the help, material :)
 
C

Cyde Weys

Jon said:
How do you know you wouldn't have been more likely to get an answer in
comp.infosystems.www.servers.* or comp.infosystems.www.authoring.cgi? I
don't see any postings from you in those groups.

Because on my newsgroup server, c.l.p.misc has 3000 posts, while
c.i.w.s.misc, c.i.w.s.unix, and c.i.w.a.cgi have only 17, 281, and 68
posts, respectively.

If you want an answer quickly, do you ask a few people or a whole crowd?
And while some may have pointed out that my question was slightly
off-topic in this newsgroup, it's still relevant. And it also generated
all sorts of discussions and follow-up questions that definitely were
relevant to Perl.
 
C

Cyde Weys

James said:
Try 'chomd -Rv 755 <your cgi-bin directory>'.

That's not the problem. The directory my .pl file was in and the .pl
file itself were already set to executable. The problem was that I
didn't have Options +ExecCGI specified in the right place to override
the "no overrides" put on the root /var/www/html directory.
Again, this issue lies with your configuration of Apache, _not_ with
Perl.

Technically, a chmod on a directory doesn't even have to do with the
configuration of Apache ... just the directory attributes of your
filesystem.
HTH and Have a nice day!

I hope you have a nice day too.
 
C

Cyde Weys

Alan J. Flavell wrote:

When you find yourself down a hole, it's wise to stop digging.

In what way am I digging? They already plonked me, so it's not like
they were going to see my response. I was just expressing my
frustration at people who plonk someone for the slightest off-topic-ness.

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.

Discourteous? Excuse me? How have I ever been discourteous so far? I
didn't call those who plonked me "idiots". I just asked what was the
point of saying *plonk* ... I mean, that's even more off-topic than my
original post, right? If they apply the standards to themselves that
they apply to others, then shouldn't they expect to be plonked by
everyone else for posting a message consisting solely of "*plonk*" that
is clearly off-topic?

And let me refer you to my original post. "... any help would be
greatly appreciated. Thanks. " I don't know how you got discourteous
out of that, but to me it seems like I was eager to appreciate the help
that I hoped some of you posters out there would deliver.
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'.

I have no need to convince the hon. Usenauts (whatever that is) that I
am not stupid. I know I am not stupid, and thus I don't care if someone
calls me stupid; and perhaps it is advantageous if people think me
stupid so that I can use their underestimation of my intelligence
against them sometime in the future?
 
A

A. Sinan Unur

On Sun, 07 Sep 2003 14:07:32 -0400, Cyde Weys wrote:
Well, DUH, I know how to use CGI.pm. So I fixed up my .pl file and
everything works now!

Hmm ... not too well.

Try:

#! C:/Perl/bin/perl

use strict;
use warnings;

use CGI qw:)standard);

print header('text/html');
print
start_html({-title => 'Terpy - a part of the UMCP Underground'}),
h1('Terpy - a part of the UMCP Underground'),
p("Hello, my name is Ben McIlwain.",
"This site doesn't have much on it yet."),
p(em("See the source ", a({-href => "index.txt"}, 'here').'.' )),
end_html();

__END__
 
T

Tad McClellan

Cyde Weys said:
In what way am I digging?


You may convince yet more people to plonk you.

Discourteous? Excuse me? How have I ever been discourteous so far?


By posting an off-topic article.

I just asked what was the
point of saying *plonk*


So that the lurkers will know what price they may pay should
they ever feel the urge to post their server setup questions here.

If there were no negative responses, then they'd think it was
OK, and post _their_ server setup question, causing them to
hurt their chances of getting answers to all future Perl questions.

Letting them know that they could be ostracized for socially
unacceptable behavior may discourage such behavior.

original post, right? If they apply the standards to themselves that
they apply to others, then shouldn't they expect to be plonked by
everyone else for posting a message consisting solely of "*plonk*" that
is clearly off-topic?


If someone takes cuts in line, you wouldn't say anything about it?

You are more tolerant than can be expected of most folks.
 
G

Gunnar Hjalmarsson

Cyde said:
Because on my newsgroup server, c.l.p.misc has 3000 posts, while
c.i.w.s.misc, c.i.w.s.unix, and c.i.w.a.cgi have only 17, 281, and
68 posts, respectively.

If you want an answer quickly, do you ask a few people or a whole
crowd?

So, your decision to post here was that well considered? With that
attitude, you deserve all the rough treatment you got.

Maybe it's true that you are not stupid. But you are inconsiderate.
You are rude.
 
C

Cyde Weys

Just a thought - if you actually did *plonk* me as you claimed to, how
are you responding to my post?
 
J

Jon Bell

Because on my newsgroup server, c.l.p.misc has 3000 posts, while
c.i.w.s.misc, c.i.w.s.unix, and c.i.w.a.cgi have only 17, 281, and 68
posts, respectively.

If you want an answer quickly, do you ask a few people or a whole crowd?

You'll probably find even more postings in rec.photo.digital. Does that
make it a better place to ask about configuring Web servers? Surely there
are some people there who know something about Web servers.
 
A

Anno Siegel

Cyde Weys said:
Because on my newsgroup server, c.l.p.misc has 3000 posts, while
c.i.w.s.misc, c.i.w.s.unix, and c.i.w.a.cgi have only 17, 281, and 68
posts, respectively.

Of those 3000 posts on clpm, 1500 are questions, 1000 are answers
already provided by the 10-12 active regulars here and 500 are off
topic or replies explaining that they are. How very thoughtful of
you to throw another off-topic posting in the mix.
If you want an answer quickly, do you ask a few people or a whole crowd?

So you do what (you think) gets you an answer most quickly without
regard if your question is welcome? How selfish.

BTW, most of the crowd have as little Perl experience as you.
And while some may have pointed out that my question was slightly
off-topic in this newsgroup, it's still relevant. And it also generated
all sorts of discussions and follow-up questions that definitely were
relevant to Perl.

None that I've seen.

Anno
 
T

Tad McClellan

Cyde Weys said:
Just a thought - if you actually did *plonk* me as you claimed to, how
are you responding to my post?


They have these newfangled thingies called "scoring newsreaders",
I use one of those.

Your high negative score can be overcome by other positive scoring
rules, so it is possible that even your articles can end up above
the "invisible" score level.

It may auto-delete your messages, but I can manually undelete them if
I want to. I often do that for a short time after plonking to
verify that I've taken the correct action.

I've seen enough for that already.
 
A

A. Sinan Unur

I'm using Linux, not Windows, but thanks for all of the other relevant
help!

You know and I know and everyone else knows that the she-bang line is
system dependent, and I really do not care what operating system you use. I
cannot see the point of this response.

Sinan.
 

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