Newbie "Hello, World" problem

Discussion in 'Perl Misc' started by NullBock, Aug 8, 2005.

  1. NullBock

    NullBock Guest

    So I'm trying to get my first PERL script working; here it is,

    print "Content-type: text/html\n\n";
    print "Hello, World.";

    Permissions look good :

    -rwxr-xr-x 1 root root 79 Aug 8 05:10

    Running it via a web-browser shows an internal error :

    The log gives me the following message:
    [Mon Aug 08 04:55:27 2005] [error] [client] (2)No such file or
    directory: exec of '/var/www/cgi-bin/' failed
    [Mon Aug 08 04:55:27 2005] [error] [client] Premature end of
    script headers:

    Running the script via the command line (./ results in a "bad
    interpreter: No such file or directory" error; but the perl path is
    corrent! Explicitly calling the perl interpreter (/user/bin/perl results in the proper output :

    Content-type: text/html

    Hello, World.

    Any ideas?

    Walter Gildersleeve
    Freiburg, Germany
    NullBock, Aug 8, 2005
    1. Advertisements

  2. NullBock

    Brian Wakem Guest

    Mandrake/Mandriva uses the same path.
    Brian Wakem, Aug 8, 2005
    1. Advertisements

  3. NullBock

    NullBock Guest

    I'm using White Box Enterprise on a VPS.
    NullBock, Aug 8, 2005
  4. NullBock

    Paul Lalli Guest

    Your first Perl (not PERL) script should probably not be a CGI script.
    Learn to get Perl working on the command line first, then learn how to
    program CGI. Just my opinion of course.
    When my students get this error, the first thing I ask them is whether
    or not they wrote their program in Windows and then transferred it (via
    something other than FTP ASCII mode) to Unix. If this is the case, you
    most likely have the wrong line endings, and you are attempting to
    execute an interpreter named "/usr/bin/perl\r". If this is the case,
    you can fix the line endings by running the dos2unix program that comes
    standard with most Unix distrobutions. (Check its man page for more

    Just a random guess on my part. It may not be correct.

    Paul Lalli
    Paul Lalli, Aug 8, 2005
  5. Hi,

    Even I have see the similar problem in mandrake.

    Just run dos2unix command on your script.. it should work fine---this
    is temp. fix.
    For permanent fix, recreate the cgi-bin directory.

    This is because of vi command problem.. i think by default it creats
    the dos file.


    --sopan shewale
    sopan.shewale, Aug 8, 2005
  6. NullBock

    NullBock Guest

    Thanks for the tips, it was in fact a DOS/UNIX problem. dos2unix did
    the trick.
    This is semantic, isn't it? PERL was (is) an acronym...I assume you
    hold that it's in common-enough use that the Perl form is correct? I
    could agree, but then I still see SCUBA now and again.
    NullBock, Aug 8, 2005
  7. NullBock

    Paul Lalli Guest

    Glad to hear it.
    No, it wasn't and isn't. Please read:
    perldoc -q difference.
    No. I hold that Perl is the actual name of the language, and that PERL
    has never been correct.
    SCUBA is an acronym. It was created as a shortened way of saying "Self
    Contained Underwater Breathing Appratus" (or similar - please let's not
    start a thread about this if my memory isn't correct). Perl was the
    name given by Larry Wall to his new language. It was only after the
    fact that some people decided the letters might stand for anything in
    particular. It is a retronym, not an acronym.

    Paul Lalli
    Paul Lalli, Aug 8, 2005
  8. NullBock

    Big and Blue Guest

    Why, having told teh client that it you will send text/html, do you
    send plain text rather than html? Either:

    a) set the type to text/plain or
    b) send html.
    Big and Blue, Aug 11, 2005
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.