Skip to contentSkip to conversation

error: premature end of script headers in cgi

DISCUSSION William Stanard 3 participants 3 messages Aug 31, 2004

lore
Share & tools
lore
#0 lore raw

I'm running Linux 2.4.18-14smp on a Compaq Proliant. When trying to run gm.cgi (correctly chmod-ed, I believe) to start using Greymatter blogging, I receive the following error when I look at the httpd error_log:

[error] [client 10.0.4.126] Premature end of script headers: gm.cgi

I am guessing that in moving the cgi scripts to my Linux box via Dreamweaver, I "added" some bogus carriage returns or some such... How can I (first) see if that is what I did and (two) edit same...

Bill Stanard
Academic Computing
Palmer Trinity School

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

#1 lore raw
Quoted 6 lines · William Stanard

[error] [client 10.0.4.126] Premature end of script headers: gm.cgi

I am guessing that in moving the cgi scripts to my Linux box via Dreamweaver, I "added" some bogus carriage returns or some such... How can I (first) see if that is what I did and (two) edit same...

Bill: I'm no expert, and perhaps someone more knowledgeable might be able to explain better, but I believe your guess may be correct. The carriage returns for DOS/Windows are different from those in UNIX (which Linux more closely resembles, of course.)

The program you want is probably the command-line utility dos2unix. Seems to be pretty standard on most Linux installations. From "man dos2unix":

" tofrodos - Converts text files between DOS and Unix formats.

SYNOPSIS
fromdos [ options ] [file...]
todos [ options ] [file...]

DESCRIPTION
DOS text files traditionally have carriage return and line feed
pairs
as their newline characters while Unix text files have the line
feed as
their newline character. fromdos converts text files from the
DOS for-
mat to the Unix format, while todos converts text files from
the Unix
format to the DOS format. ...."

Hope this helps...

Peter

Signature · 7 lines
Windows belongs to Microsoft: Linux belongs to humanity

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
#2 lore raw
In reply to William Stanard

Hi,

Quoted 11 lines · On Tue, 31 Aug 2004 10:47:44 -0400 "William Stanard"…

I'm running Linux 2.4.18-14smp on a Compaq Proliant. When trying to run gm.cgi (correctly chmod-ed, I believe) to start using Greymatter blogging, I receive the following error when I look at the httpd error_log:

[error] [client 10.0.4.126] Premature end of script headers: gm.cgi

I am guessing that in moving the cgi scripts to my Linux box via Dreamweaver, I "added" some bogus carriage returns or some such... How can I (first) see if that is what I did and (two) edit same...

There are a few methods to see non printing characters in a file. Try
cat -v filename

In vi, in command mode you can do:
: set list
and all the 'funny' characters will be displayed.
Do:
: set nolist
to make the file appear normal.

Personally whenever I come across an MS-dos file on Unix, I first check it in vi with the :set list command and then I do a vi command like:

:%s/<CTRL>v<CTRL>M//g

This is a substitute command.
The % sign means apply the command to the whole file
s means substitute.
/ is the delimiter
<CTRL>v means dont interpret the next keystroke
<CTRL>M is the 'funny' character you want to get rid of. In this case it is control M, though you may find something else in your particuliar file. g means do the command globally ie do it as many times as necessary on each line.

Of course if it all goes wrong, you can type u in command mode and the change will be undone :-)

Hope this helps.

regards,

John Kelly

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs