ever heard of this??? - Premature end of script headers.....

They have: 5,633 posts

Joined: Jan 1970

wonder if somebody ever heard about something like this:
i'm working for several projekts, mainly cgi and need to run them on a unix-based server. problem is, i don't have direct access to the machine, so i can't tell very much about what's going on there....
what makes me go crazy is this:
i try to run this script:

#!/usr/bin/perl

print<<EOF;
content-type:text/html
hello world!

EOF

and get the error message "premature end of script...."
but get this:
there is a script in the cgi-bin directory that runs perfect,
i open this script, delete everything except the first (exactly the same as described above) and add the printing lines, save it back with another name, and it works!!!!
none of us can't find the bug, and we don't have access to the server until next week... Sad
i've tried several editors and nothing made any changes...
does anybody know, where the problem might be???

John Pollock's picture

He has: 628 posts

Joined: Mar 1999

Yes, it has happened to me a number of times. I'm not really sure what it is, because the code looked fine the way you had it.

I eventually got this one to work, but I had to move the mime header above the rest of it:

#!/usr/bin/perl

print "Content-type: text/html\n\n";
print <<EOF;
hello world!
EOF

I don't know if it makes a difference, but I also put a space between the print and the <<.

----------
John Pollock
http://www.pageresource.com

They have: 5,633 posts

Joined: Jan 1970

it doesn't, but that's not important.... Smiling

did i mention, i don't upload via FTP or something like this, i'm connected to the server via LAN!

cu
p

John Pollock's picture

He has: 628 posts

Joined: Mar 1999

Hmm.. maybe that is it, I haven't tried connecting via a LAN. Interesting, though. Smiling

----------
John Pollock
http://www.pageresource.com

They have: 5,633 posts

Joined: Jan 1970

the LAN was the bug!
should have thought of that before, it's just too simple...Smiling
the network transfers the data in binary mode! this is the first thing you learn as a rookie, but i just didn't think about something that simple....
cu
patrick

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.