serambin has asked for the wisdom of the Perl Monks concerning the following question:

I'm still having problems getting basic scripts to run on a new server.
#!/usr/bin/perl use CGI::Carp qw(fatalsToBrowser); print "Hello World!\n";
(I told you it was simple)

Here's the error: [Thu Sep  5 16:56:47 2002] [error] [client 66.19.141.123] Premature end of script headers: /home/lhost/public_html/cgi-bin/test2.cgi It might be a path problem, or a server conf problem or ...?

Can anyone help?

Stan
http://ladatahost.com

Edit by dws for title and tag cleanup

Replies are listed 'Best First'.
Re: Error from CGI on new server
by sauoq (Abbot) on Sep 05, 2002 at 21:26 UTC

    You aren't printing an HTTP content-type header. Try:

    #!/usr/bin/perl print "Content-type: text/plain\n\n"; print "Hello World!\n";

    Ovid has a Web Programming with Perl course that you might benefit from.

    -sauoq
    "My two cents aren't worth a dime.";
    
      Deo Gratius. Pax Vobiscum I'll take your advice on the Perl refresher. Stan http://ladatahost.com
Re: Error from CGI on new server
by Ovid (Cardinal) on Sep 05, 2002 at 21:50 UTC

    You forgot to print a header.

    #!/usr/bin/perl -wT use strict; use CGI qw/:standard/; use CGI::Carp qw/ fatalsToBrowser /; #remove for production print header( 'text/plain' ), 'Hello, World!';

    Cheers,
    Ovid

    Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.