Perl/Linux problem.

2003-09-11 Thread Sara
I recently installed RH 9.0 on my machine with pre-configured Apache and Perl.

I made a simple script HELLO WORLD to check the Perl and it gave me a continuous 
error for 500 Internal Server Error and Premature End of Script Headers.

I double checked the perl path, permissions, httpd.conf etc, everything looks fine, 
ran the script in terminal (perl -wc)  and it produced desired output, verified the 
syntax is ok and there is no problem with this 3 line script, but in the browser it 
again failed to run.

I thought another way of testing it, Using LAN (and samba) I copied a simple script 
from my Windows machine to Apache and ran that script and amazingly it ran without any 
problem (both in terminal and mozilla)

So, what I have assumed that there must be some problem with scripts that I am writing 
in the Linux environment. I am using text editor of Linux (gedit) for saving the 
scripts. I am at a loss now as what I am doing wrong. The simple scripts like 'Hello 
world' written in gedit failed to run (in browser only) but a bit complex script 
imported from Windows XP is runing smoothly?

Do I need to change the text editor for Linux, if yes, what are the recommendations?

Thanks for any input.

Sara.




RE: Perl/Linux problem.

2003-09-11 Thread Wiggins d'Anconia


On Thu, 11 Sep 2003 15:37:05 +0500, Sara [EMAIL PROTECTED] wrote:

 I recently installed RH 9.0 on my machine with pre-configured Apache and Perl.
 
 I made a simple script HELLO WORLD to check the Perl and it gave me a continuous 
 error for 500 Internal Server Error and Premature End of Script Headers.
 
 I double checked the perl path, permissions, httpd.conf etc, everything looks fine, 
 ran the script in terminal (perl -wc)  and it produced desired output, verified the 
 syntax is ok and there is no problem with this 3 line script, but in the browser it 
 again failed to run.
 
 I thought another way of testing it, Using LAN (and samba) I copied a simple script 
 from my Windows machine to Apache and ran that script and amazingly it ran without 
 any problem (both in terminal and mozilla)
 
 So, what I have assumed that there must be some problem with scripts that I am 
 writing in the Linux environment. I am using text editor of Linux (gedit) for saving 
 the scripts. I am at a loss now as what I am doing wrong. The simple scripts like 
 'Hello world' written in gedit failed to run (in browser only) but a bit complex 
 script imported from Windows XP is runing smoothly?
 
 Do I need to change the text editor for Linux, if yes, what are the recommendations?
 
 Thanks for any input.
 

What does the Apache error log have in it?  Usually that is the best way to tell 
exactly waht the error is. 

Without that all the claims you make to checking everything are suspect

http://danconia.org

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Perl/Linux problem.

2003-09-11 Thread Sara
Apache Error Log: premature end of script headers


Thanks,

Sara.

- Original Message -
From: Wiggins d'Anconia [EMAIL PROTECTED]
To: Sara [EMAIL PROTECTED]; beginperl [EMAIL PROTECTED]
Sent: Friday, September 12, 2003 3:45 AM
Subject: RE: Perl/Linux problem.


:
: 
: On Thu, 11 Sep 2003 15:37:05 +0500, Sara [EMAIL PROTECTED] wrote:
:
:  I recently installed RH 9.0 on my machine with pre-configured Apache and
Perl.
: 
:  I made a simple script HELLO WORLD to check the Perl and it gave me a
continuous error for 500 Internal Server Error and Premature End of
Script Headers.
: 
:  I double checked the perl path, permissions, httpd.conf etc, everything
looks fine, ran the script in terminal (perl -wc)  and it produced desired
output, verified the syntax is ok and there is no problem with this 3 line
script, but in the browser it again failed to run.
: 
:  I thought another way of testing it, Using LAN (and samba) I copied a
simple script from my Windows machine to Apache and ran that script and
amazingly it ran without any problem (both in terminal and mozilla)
: 
:  So, what I have assumed that there must be some problem with scripts
that I am writing in the Linux environment. I am using text editor of Linux
(gedit) for saving the scripts. I am at a loss now as what I am doing wrong.
The simple scripts like 'Hello world' written in gedit failed to run (in
browser only) but a bit complex script imported from Windows XP is runing
smoothly?
: 
:  Do I need to change the text editor for Linux, if yes, what are the
recommendations?
: 
:  Thanks for any input.
: 
:
: What does the Apache error log have in it?  Usually that is the best way
to tell exactly waht the error is.
:
: Without that all the claims you make to checking everything are
suspect
:
: http://danconia.org


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Perl/Linux problem.

2003-09-11 Thread Sara
Yep, I did that, tried every single option to remove this premature end of
script headers.

Do you think it has to do something with 'gedit' text editor? because I am
scripting in this editor for the very first time.
The scripts copied from Window XP machine have no problems at all, runing
smoothly, only those are producing error which I am writing in the Linux
machine. Why?

use CGI qw(header);
use CGI::Carp qw(fatalsToBrowser);


print header;
print Hello world;


-

with CGI.pm

$q-print($q-header( type = 'text/html')

--

and simply

print Content-Type: text/html\n;

print Hello World\n;

--


Thanks,



Sara.





- Original Message -
From: drieux [EMAIL PROTECTED]
To: cgi cgi-list [EMAIL PROTECTED]
Sent: Friday, September 12, 2003 4:31 AM
Subject: Re: Perl/Linux problem.


:
: Sara,
:
: Wiggins is right, one of the questions is what exactly
: did the Apache Error Log say was it's chief complaint.
:
: The 'premature end of script headers' suggest that your
: output does not have a content-type or there is
: CRLF separating them.
:
: eg:
: [jeeves: 45:] test_cgi GET simple.cgi
: Content-Type: text/plain
: hello World
: [jeeves: 46:]
:
: which is not a separation from the header and the body:
:
: [jeeves: 47:] test_cgi GET simple.cgi
: Content-Type: text/plain
:
: hello World
: [jeeves: 48:]
:
: The script for that is at the end.
:
: Excuse me while I help adjust Wiggins Hair
:
: On Thursday, Sep 11, 2003, at 15:45 US/Pacific, Wiggins d'Anconia wrote:
: [..]
: 
:  Without that all the claims you make to checking everything are
:  suspect
:
: bad hair day there wiggins?
:
: THWACK! THWACK! THWACK
:
: did that help loosen up the dandruf.
:
: ciao
: drieux
:
: ---
: the simple code:
: ### #!/usr/bin/perl -w
: ### use strict;
: ###
: ### our $CRLF = \015\012;   # \r\n is not portable
: ### my $type = text/plain;
: ### print Content-Type: $type . $CRLF . $CRLF . hello World
:
:
:
: --
: To unsubscribe, e-mail: [EMAIL PROTECTED]
: For additional commands, e-mail: [EMAIL PROTECTED]
:


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Perl/Linux problem.

2003-09-11 Thread david
Sara wrote:

 Apache Error Log: premature end of script headers
 
 

[snip]

 output, verified the syntax is ok and there is no problem with this 3 line
 script, but in the browser it again failed to run.

since it's only a 3 liner, can you post it?

david
-- 
$_=q,015001450154015401570040016701570162015401440041,,*,=*|=*_,split+local$;
map{~$_1{$,=1,[EMAIL PROTECTED]||3])=~}}0..s~.~~g-1;*_=*#,

goto=print+eval

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Perl/Linux problem.

2003-09-11 Thread drieux
On Thursday, Sep 11, 2003, at 06:05 US/Pacific, Sara wrote:
[..]
and simply

print Content-Type: text/html\n;

print Hello World\n;
that form will NOT have the separator
and I expect you see something like:
[..]
: [jeeves: 45:] test_cgi GET simple.cgi
: Content-Type: text/plain
: hello World
: [jeeves: 46:]
which is NOT a correct message to send back to
the web-server. You will need to have a
'blank line' between the Content-Type
and the 'hello world'.
but the:
#!/usr/bin/perl -w
use strict;
use CGI qw(header);
print header;
print Hello world;
should work since the CGI::header() will put the additional
CRLF in play and separate them...
You do have the #! line with the -w flag set?

ciao
drieux
---

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: Perl/Linux problem.

2003-09-11 Thread Jonathan E. Hogue
A cgi hello world script must have the headers in it.

For example,

#!/usr/bin/perl

print Content-Type: Text/HTML\n\n;
print Hello World;

-Original Message-
From: Sara [mailto:[EMAIL PROTECTED] 
Sent: Thursday, September 11, 2003 5:37 AM
To: beginperl
Subject: Perl/Linux problem.

I recently installed RH 9.0 on my machine with pre-configured Apache and
Perl.

I made a simple script HELLO WORLD to check the Perl and it gave me a
continuous error for 500 Internal Server Error and Premature End of
Script Headers.

I double checked the perl path, permissions, httpd.conf etc, everything
looks fine, ran the script in terminal (perl -wc)  and it produced
desired output, verified the syntax is ok and there is no problem with
this 3 line script, but in the browser it again failed to run.

I thought another way of testing it, Using LAN (and samba) I copied a
simple script from my Windows machine to Apache and ran that script and
amazingly it ran without any problem (both in terminal and mozilla)

So, what I have assumed that there must be some problem with scripts
that I am writing in the Linux environment. I am using text editor of
Linux (gedit) for saving the scripts. I am at a loss now as what I am
doing wrong. The simple scripts like 'Hello world' written in gedit
failed to run (in browser only) but a bit complex script imported from
Windows XP is runing smoothly?

Do I need to change the text editor for Linux, if yes, what are the
recommendations?

Thanks for any input.

Sara.





-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Perl/Linux problem.

2003-09-11 Thread david
Sara wrote:

 Yep, I did that, tried every single option to remove this premature end of
 script headers.
 
 Do you think it has to do something with 'gedit' text editor? because I am
 scripting in this editor for the very first time.
 The scripts copied from Window XP machine have no problems at all, runing
 smoothly, only those are producing error which I am writing in the Linux
 machine. Why?
 
 use CGI qw(header);
 use CGI::Carp qw(fatalsToBrowser);
 
 
 print header;
 print Hello world;

this looks fine. you should lose the '' sign because you are passing @_ to 
header implicitly.

 
 
 -
 
 with CGI.pm
 
 $q-print($q-header( type = 'text/html')

not sure where you declare $q so i am not going to comment on it.

 
 --
 
 and simply
 
 print Content-Type: text/html\n;
 
 print Hello World\n;
 

this is wrong. see Drieux's previous message for reason.

chances are that when you move (you said you copied the script from a 
windows xp machine and then work on it in gedit?) the script from windows 
to linux, your script is carrying over the \r character. gedit won't show 
that to you. try:

[panda]$ head -1 script.cgi | od -c

and see if you see any '\r' character anywhere. if you do, that's probably 
the cause of the problem. remove those characters with:

[panda]$ perl -i -pe 's/\r//' script.cgi

and then run your script again.

david
-- 
$_=q,015001450154015401570040016701570162015401440041,,*,=*|=*_,split+local$;
map{~$_1{$,=1,[EMAIL PROTECTED]||3])=~}}0..s~.~~g-1;*_=*#,

goto=print+eval

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]