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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What means: "Premature end of script headers"

Status
Not open for further replies.

mizrobin

Programmer
Jul 17, 2000
5
US
We migrated to an new server running Apache, and suddenly our scripts are useless.&nbsp;&nbsp;I'm useless too at trying to figure this out since I inherited this project and have never written a Perl script in my life.&nbsp;&nbsp;&nbsp;The error message says something about internal error or configuration problem.&nbsp;&nbsp;The helpful techies over at the new host must all be on vacation because they don't respond (surprise!).<br><br>Ideas???&nbsp;&nbsp;What do I need to tweak to get this sucker running?<br>
 
Can you post some of a script causing this problem, the only time I got this error on our Apache server was when I hadn't got my <br><FONT FACE=monospace>print &quot;content-type:text/html\n\n&quot;</font><br>string incorrect.<br><br>Cheers<br>Loon
 
Since Perl buffers its 'print' output, the error could be nearly anywhere in your CGI.&nbsp;&nbsp;The error you're getting simply means the browser did not get enough HTML to make any sense of it.&nbsp;&nbsp;Check your syntax and enable a little error checking, if the syntax is OK.&nbsp;&nbsp;I use a simple sub to report CGI errors like failures to open files and such....like..<br><br><FONT FACE=monospace><br># print HTML content-type, open, head, title, body, paragraph..... then<br>open(IPF,&quot;&lt;someInPutFile&quot;) or &showError(&quot;Failed to open IPF, $!&quot;);<br># do stuff with the input .....<br>close IPF;<br><br>sub showError<br>{<br>my $error = $_[0];<br>print &quot;ERROR - $error&lt;BR&gt;\n&quot;;<br>print &quot;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;&quot;;<br>exit;<br>}<br></font><br><br><br>If you fail to open the ipput file, you will still get compliant html to the browser.<br><br>'hope this helps.... <p> <br><a href=mailto: > </a><br><a href= > </a><br> keep the rudder amid ship and beware the odd typo
 
hi, mizrobin<br><br>i also got this error message when my perl script contains syntax errors. try to compile your perl script with the command:<br><br>&nbsp;&nbsp;perl -c yourscript.cgi<br><br> <p> <br><a href=mailto: > </a><br><a href= > </a><br>ttest<br>
:) happy programming :)
 
I designed a very handy script for such situations that will let you debug any script from your web browser with a point and a click. Any errors are itemized and reported in your browser and there's no need to amend your script with error-reporting subroutines...

AdminPro may be downloaded at and I've been told just about installs itself.

That should make the process of debugging your all your scripts much easier.

Craig Richards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top