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 strongm 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: post.cgi

Status
Not open for further replies.

pichi

Programmer
Nov 12, 2000
156
EC
hi everyboyd, i am new at cgi-bin, but everytime i want to test a pl file i get this error:
Premature end of script headers: post.cgi

the file and directory ownership of my http dir are apache and apache for group, (dir http: /home/http/docs) i can see my web page, and the cgi-bin dir (/var/ has the apache and apache ownership , the file permissions are 777, so everybody can excute, waht's wrong ?? does anybody know??
 
Did the script come from dos/win?
If so, it has carriage returns along with linefeeds.
linux/unix only uses linefeeds.
Find a dos2unix util and run it on the script.
 
I just ran into this problem last night. I was trying to implement an older linux script that worked on someone else's server. Here's the solution: the first two lines of your script file must be:

#!/usr/local/bin/perl
print "Content-type: text/html\n";

Check to be sure the first line really is the path to your PERL executable; for my version of linux, that had changed.

The second line was in my script file, but further down. Moving it up to where it is fixed my problem. Newposter
"Good judgment comes from experience. Experience comes from bad judgment."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top