Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

'premature end of script headers' error...any ideas why?

Status
Not open for further replies.

spewn

Programmer
May 7, 2001
1,034

i have this script for perl 5.8.1 on an apache server running cpanel.

Code:
#!/usr/bin/perl

use strict; 
use CGI qw(:standard);

print header();
 
print << "EOF";

<HTML>
<HEAD>
<title> Test Page </title>
</HEAD>

<body>

<table cellspacing=0 cellpadding=0 width=650 align=center>
<tr>
<td>test</td>
</tr>
</table>

</body>
</html>

EOF

as you can see, there is nothing really fantastic about it, but the error is still generating. any ideas?

- g
 
Needs a blank line after EOF, I think its actually looking for
EOF\n

It's chucking an error at run time without the \n

--Paul

cigless ...
 
Try to change the

print header();

with

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

Or with

print header(),"\n\n";

Tell us what you get
 
the error is still generating
What error?

Try removing the space between << and "EOF".
Also, why do you need quotes around EOF?

 
I just had the same thing and when I vi'ed my file on the server there was a bunch of ^M's at the end of each line.

Check that you save in *NIX format.

 
Is there any particular reason why you are not using the CGI module to print all of the HTML?
You have used header(), but you are not using any other functions.
After header() try replacing all html with (out of the << EOF block) with:
Code:
print start_html(-title=>'Test Page');
print table ({border=>1},
	Tr([ td(["Test","Table"]) ])
   );
end_html();
Type 'perldoc CGI' into a command prompt for some light reading.
 

i wasn't uploading the files in the proper format...binary vs ascii.

as far as my style, it's the way i learned, so it's the way i do.

thanks again!

- g
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top