You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Denis Peuziat <dp...@amadeus.com> on 2008/06/02 11:46:58 UTC

Re: [users@httpd] problem with perl script and Apache

Thanks a lot for your advice. The file shows the html result so I guess 
there has been some changes between Apache 2.0.46 and 2.2.3 that prevents 
the 2.2.3 to understand the html headers on the page...
I will look in that direction
Thanks again
Denis



"Octavian Rasnita" <or...@gmail.com> 
To
<us...@httpd.apache.org>
cc

Subject
Re: [users@httpd] problem with perl script and Apache





"Octavian Rasnita" <or...@gmail.com> 
Please respond to : users@httpd.apache.org
30/05/2008 15:49


How does it look the content of the downloaded perl file?

It shows the perl source code, or the html page which should be created by 

the script?

If it shows the source code, it means that the program is not executed 
because Apache is not configured correctly.

If it shows the html result, it means that the script doesn't send the 
correct HTTP headers, so you should fix the script.

Octavian

----- Original Message ----- 
From: "Denis Peuziat" <dp...@amadeus.com>
To: <us...@httpd.apache.org>
Sent: Friday, May 30, 2008 3:18 PM
Subject: [users@httpd] problem with perl script and Apache


> Apache 2.2.3 + Perl 5.8.8 on SUSE SLES10
>
> I have just migrated a site from a linux RH server with Apache 2.0.46 
and
> perl 5.8.0 to a server with the config above.
>
> Some perls scripts that are still executing correctly on the old server,
> are now identified as Unknown files when page is launched in a 
webbrowser
> (pop up asking to open or save document)
>
> I say some because other pages containing perl scripts are working as
> expected.....
>
> The same scripts are working when executed locally on the server with 
perl
> xxxx.pl command.
>
> The only difference is that these scripts are using a "home-developed"
> module.
>
> Would it be possible that the change of environment would render the
> module useless?
>
> Thanks for your help
>
> Denis 


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org



Re: [users@httpd] problem with perl script and Apache

Posted by Denis Peuziat <dp...@amadeus.com>.
"Krist van Besien" <kr...@gmail.com> 
To
users@httpd.apache.org
cc

Subject
Re: [users@httpd] problem with perl script and Apache





"Krist van Besien" <kr...@gmail.com> 
Please respond to : users@httpd.apache.org
02/06/2008 16:31


On Mon, Jun 2, 2008 at 2:44 PM, Octavian Rasnita <or...@gmail.com> 
wrote:

> At the beginning of the output generated by your script, you should do:
>
> print "Content-Type: text/html\n\n";

>Exactly.
>
>A minimal script would be:
>
>#!/usr/bin/perl
>
>print "Content-type: text/html\n\n";
>print <<HTML;
><html>
><body>
><p>Hello World</p>
></body>
>HTML
>exit;
>
>And this would, when executed on the command line, output:
>
>Content-Type: text/html
>
><html>
><body>
><p>Hello World</p>
></body>
>
>The Content-Type is importan, because it allows your apache server to
>know what the script will output. (CGI scripts can produce whatever
>you fancy. I have scripts that produce PNGs and SVGs for example...)

I solved the issue :o). I was really puzzled that the script would execute 
properly locally... and you put me on the right track with your last 
reply! I executed it again and found out that there was a flaw within the 
script that produced an output before the "Content-type..." line
I modified it and everything now works properly!

Thanks for your answers 

Denis



Re: [users@httpd] problem with perl script and Apache

Posted by Krist van Besien <kr...@gmail.com>.
On Mon, Jun 2, 2008 at 2:44 PM, Octavian Rasnita <or...@gmail.com> wrote:

> At the beginning of the output generated by your script, you should do:
>
> print "Content-Type: text/html\n\n";

Exactly.

A minimal script would be:

#!/usr/bin/perl

print "Content-type: text/html\n\n";
print <<HTML;
<html>
<body>
<p>Hello World</p>
</body>
HTML
exit;

And this would, when executed on the command line, output:

Content-Type: text/html

<html>
<body>
<p>Hello World</p>
</body>

The Content-Type is importan, because it allows your apache server to
know what the script will output. (CGI scripts can produce whatever
you fancy. I have scripts that produce PNGs and SVGs for example...)

Krist

-- 
krist.vanbesien@gmail.com
krist@vanbesien.org
Bremgarten b. Bern, Switzerland
--
A: It reverses the normal flow of conversation.
Q: What's wrong with top-posting?
A: Top-posting.
Q: What's the biggest scourge on plain text email discussions?

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] problem with perl script and Apache

Posted by Octavian Rasnita <or...@gmail.com>.
From: "Denis Peuziat" <dp...@amadeus.com>
>>CGI scripts must output a "content-type" header. So when you execute
>>them on the command line, the line "content-type: text/html" ought to
>>be the first thing written out. If they don't do this they have been
>>programmed with a disregard of the CGI standard....
>>It is possible that your old webserver was configured to always add
>>this content-type header itself, and that because of this the scripts
>>worked.
> 
> so the only thing to do is to add a line like <meta 
> http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 
> at the beginning of the script?
> 
> Denis

Not exactly.

At the beginning of the output generated by your script, you should do:

print "Content-Type: text/html\n\n";

Octavian


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] problem with perl script and Apache

Posted by Denis Peuziat <dp...@amadeus.com>.
"Krist van Besien" <kr...@gmail.com> 
To
users@httpd.apache.org
cc

Subject
Re: [users@httpd] problem with perl script and Apache





"Krist van Besien" <kr...@gmail.com> 
Please respond to : users@httpd.apache.org
02/06/2008 13:42


On Mon, Jun 2, 2008 at 12:23 PM, Denis Peuziat <dp...@amadeus.com> 
wrote:
>
> I can't see any....

>Any what?
>Can I assume that you were responding to my question whether your
>scripts wrote a content-type header? (I can't be sure what it was
>exactly you were reacting to because you choose to "top post").

sorry about that...

>CGI scripts must output a "content-type" header. So when you execute
>them on the command line, the line "content-type: text/html" ought to
>be the first thing written out. If they don't do this they have been
>programmed with a disregard of the CGI standard....
>It is possible that your old webserver was configured to always add
>this content-type header itself, and that because of this the scripts
>worked.

so the only thing to do is to add a line like <meta 
http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 
at the beginning of the script?

Denis


Re: [users@httpd] problem with perl script and Apache

Posted by Krist van Besien <kr...@gmail.com>.
On Mon, Jun 2, 2008 at 12:23 PM, Denis Peuziat <dp...@amadeus.com> wrote:
>
> I can't see any....

Any what?
Can I assume that you were responding to my question whether your
scripts wrote a content-type header? (I can't be sure what it was
exactly you were reacting to because you choose to "top post").

CGI scripts must output a "content-type" header. So when you execute
them on the command line, the line "content-type: text/html" ought to
be the first thing written out. If they don't do this they have been
programmed with a disregard of the CGI standard....
It is possible that your old webserver was configured to always add
this content-type header itself, and that because of this the scripts
worked.

Krist

-- 
krist.vanbesien@gmail.com
krist@vanbesien.org
Bremgarten b. Bern, Switzerland
--
A: It reverses the normal flow of conversation.
Q: What's wrong with top-posting?
A: Top-posting.
Q: What's the biggest scourge on plain text email discussions?

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] problem with perl script and Apache

Posted by Denis Peuziat <dp...@amadeus.com>.
I can't see any....

Denis



"Krist van Besien" <kr...@gmail.com> 
To
users@httpd.apache.org
cc

Subject
Re: [users@httpd] problem with perl script and Apache





"Krist van Besien" <kr...@gmail.com> 
Please respond to : users@httpd.apache.org
02/06/2008 12:20


On Mon, Jun 2, 2008 at 11:46 AM, Denis Peuziat <dp...@amadeus.com> 
wrote:
> Thanks a lot for your advice. The file shows the html result so I guess
> there has been some changes between Apache 2.0.46 and 2.2.3 that 
prevents
> the 2.2.3 to understand the html headers on the page...

So the scripts are executing. However do your scripts write a
"content-type text/html" header`?

Krist

-- 
krist.vanbesien@gmail.com
krist@vanbesien.org
Bremgarten b. Bern, Switzerland
--
A: It reverses the normal flow of conversation.
Q: What's wrong with top-posting?
A: Top-posting.
Q: What's the biggest scourge on plain text email discussions?

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org



Re: [users@httpd] problem with perl script and Apache

Posted by Krist van Besien <kr...@gmail.com>.
On Mon, Jun 2, 2008 at 11:46 AM, Denis Peuziat <dp...@amadeus.com> wrote:
> Thanks a lot for your advice. The file shows the html result so I guess
> there has been some changes between Apache 2.0.46 and 2.2.3 that prevents
> the 2.2.3 to understand the html headers on the page...

So the scripts are executing. However do your scripts write a
"content-type text/html" header`?

Krist

-- 
krist.vanbesien@gmail.com
krist@vanbesien.org
Bremgarten b. Bern, Switzerland
--
A: It reverses the normal flow of conversation.
Q: What's wrong with top-posting?
A: Top-posting.
Q: What's the biggest scourge on plain text email discussions?

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org