The short answer...

Make sure this is the first print statement:

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


The long answer...

CGI scripts work by passing the web server a header part and a body part.
The header part must contain AT LEAST the content type of the document (e.g.
"text/plain", "text/html", etc).  The header is then followed by a single
blank line, then comes the main body content for the page.

The web server takes your header info and adds some of it's own (or even
modifies yours).  It them sends this page to the client (browser) in two
parts... header, followed by a blank line, then the body content (see HTTP
specs).

The print statement I game above includes the minimal header info, the
Content-type, as well as a single blank line.  Anything after that statement
is taken by the web server as belonging to the body.

The error you recieved was because you never printed the header, only the
body, and the web server choked on it because it didn't make any sense (was
malformed).

Hope the helps.

Rob

-----Original Message-----
From: Nino V [mailto:[EMAIL PROTECTED]
Sent: Monday, October 13, 2003 1:49 PM
To: [EMAIL PROTECTED]
Subject: malformed header


Hi,

I'm trying my first perl script on a Unix server, but without any success!

The script (codice.pl) is something like this:

#!/usr/bin/perl
$home="/home/dominio/public_html";
print "Home $home";

when I run it, I get this error:

malformed header from script. Bad header=Home /home/dominio/public_:
/home/dominio/public_html/cgi-bin/codice.pl

Can someone help me to understand where I'm wrong?

Thanks very much,
Nino

=================================
http://www.vessella.it (italiano, esperanto, kiswahili, english)
http://www.changamano.org (Iniziative di solidarietà per la Tanzania)
Corso di lingua swahili: http://corsoswahili.vessella.net
Corso di lingua esperanto: http://esperanto.vessella.net
Jifunze lugha ya Kiesperanto: http://kiesperanto.vessella.net
Kamusi/Vortaro: http://kamusi.vessella.net
Vocabolario esperanto-italiano: http://vortaro.vessella.net
Articoli di quotidiani della Tanzania: http://habari.lernado.it


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to