Help - Search - Members - Calendar
Full Version: CGI - Premature end of script headers
Hostony Board > General Support > HowTo
MIH-Dave
Hello All,
I'm new to CGI/Perl and learning via a book (please be gentle).

Anytime I try to run a CGI file I get "500 Internal Server error". When I check my error log I see "Premature end of script headers". I've tried multiple "Hello World" scripts to no avail. What am I doing wrong?
CODE
#!/usr/bin/perl

use CGI;

$query = new CGI;

print $query->header;


print "<html><head><title>A test</title></head>\n";
print "<body>Hello World</body></html>";
Stanly
There are 2 most common problems:

1. Script code is wrong
2. Wrong permissions for the script file

Please check your permissions. They must be set to 0755.
MIH-Dave
I double check the permissions on the file, but that still didn't seem to work. I've actually tried different versions of the script, but none of them seem to work.

Location:
www.myidlehands.net/cgi-bin/test.cgi
Alec
Look at your script now.

The problem was in encoding of the script. Before upload the script to the server, you need to save the file in Unix enconding.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2024 Invision Power Services, Inc.
IPS Driver Error

IPS Driver Error

There appears to be an error with the database.
You can try to refresh the page by clicking here