"Hello World!" not working

Discussion in 'Perl Misc' started by Admin, Sep 20, 2005.

  1. Admin

    Admin Guest

    Hi Guys, I'm new to Perl, and I'm trying an "Hello World!" script but it's
    not working. I tried it on 3 different servers and I always get "Internal
    Server Error". Here's the script:

    #!/usr/bin/perl
    print "Content-Type: text/html\n\n";
    print "hello world.\n\n";

    The path to Perl is indeed /usr/bin/perl and I use a .pl or .cgi
    extension. The script is in the cgi-bin folder. The file has 755
    permissions. What is wrong?

    --
    Thanks,

    Admin.
    Want to buy me a book? http://tinyurl.com/78xzb :)
    Admin, Sep 20, 2005
    #1
    1. Advertising

  2. Admin wrote:
    > Hi Guys, I'm new to Perl, and I'm trying an "Hello World!" script but
    > it's not working. I tried it on 3 different servers and I always get
    > "Internal Server Error". Here's the script:
    >
    > #!/usr/bin/perl
    > print "Content-Type: text/html\n\n";
    > print "hello world.\n\n";
    >
    > The path to Perl is indeed /usr/bin/perl and I use a .pl or .cgi
    > extension. The script is in the cgi-bin folder. The file has 755
    > permissions. What is wrong?


    Maybe you uploaded it from a Windows box to a *nix server in binary
    mode. Try ASCII transfer mode instead.

    Another thing you can try is adding a switch to the shebang line, e.g.

    #!/usr/bin/perl -w

    --
    Gunnar Hjalmarsson
    Email: http://www.gunnar.cc/cgi-bin/contact.pl
    Gunnar Hjalmarsson, Sep 20, 2005
    #2
    1. Advertising

  3. Admin

    Shane Guest

    On Tue, 20 Sep 2005 18:19:16 -0300, Admin wrote:

    > Hi Guys, I'm new to Perl, and I'm trying an "Hello World!" script but it's
    > not working. I tried it on 3 different servers and I always get "Internal
    > Server Error". Here's the script:
    >
    > #!/usr/bin/perl
    > print "Content-Type: text/html\n\n";
    > print "hello world.\n\n";
    >
    > The path to Perl is indeed /usr/bin/perl and I use a .pl or .cgi
    > extension. The script is in the cgi-bin folder. The file has 755
    > permissions. What is wrong?


    is cgi-bin/printenv working?
    if not, have a look at apaches httpd.conf
    --
    Hardware, n.: The parts of a computer system that can be kicked

    The best way to get the right answer on usenet is to post the wrong one.
    Shane, Sep 20, 2005
    #3
  4. Admin <> wrote in
    news:eek::

    > Hi Guys, I'm new to Perl, and I'm trying an "Hello World!" script but
    > it's not working. I tried it on 3 different servers and I always get
    > "Internal Server Error". Here's the script:
    >
    > #!/usr/bin/perl
    > print "Content-Type: text/html\n\n";
    > print "hello world.\n\n";
    >
    > The path to Perl is indeed /usr/bin/perl and I use a .pl or .cgi
    > extension. The script is in the cgi-bin folder. The file has 755
    > permissions. What is wrong?


    Who knows?

    What did you see when you checked the error log?

    Oh, and, why are you lying about the content type?

    Sinan

    --
    A. Sinan Unur <>
    (reverse each component and remove .invalid for email address)

    comp.lang.perl.misc guidelines on the WWW:
    http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
    A. Sinan Unur, Sep 20, 2005
    #4
  5. Admin <> writes:

    > Hi Guys, I'm new to Perl, and I'm trying an "Hello World!" script but
    > it's not working. I tried it on 3 different servers and I always get
    > "Internal Server Error". Here's the script:


    Have you read (and followed) the advice in the Perl FAQ?

    perl -q 500

    There are two very useful links in there.

    sherm--

    --
    Cocoa programming in Perl: http://camelbones.sourceforge.net
    Hire me! My resume: http://www.dot-app.org
    Sherm Pendley, Sep 20, 2005
    #5
  6. Admin

    Admin Guest

    On Tue, 20 Sep 2005 19:12:34 -0300, Sherm Pendley <>
    wrote:

    > Admin <> writes:
    >
    >> Hi Guys, I'm new to Perl, and I'm trying an "Hello World!" script but
    >> it's not working. I tried it on 3 different servers and I always get
    >> "Internal Server Error". Here's the script:

    >
    > Have you read (and followed) the advice in the Perl FAQ?



    Thank you. I didn't change anything, but for some reason, the "Hello
    World" script is working now :)

    --
    Thanks,

    Admin.
    Want to buy me a book? http://tinyurl.com/78xzb :)
    Admin, Sep 20, 2005
    #6
  7. Admin

    Big and Blue Guest

    Admin wrote:
    >
    > #!/usr/bin/perl
    > print "Content-Type: text/html\n\n";


    So, you say you're going to send HTML, but then...

    > print "hello world.\n\n";


    ...you sedn ordinary text (ie: text/plain).

    You don't just have a Perl problem here.

    PS: I'm convinced I made a similar reply to a similar post about a month
    ago. Ah, yes. That was from "NullBlock". Only difference was (s)he
    spelt "Hello, World." correctly (but you've both omintted the !).

    So, has "NullBlock" been promoted to "admin"?


    --
    Just because I've written it doesn't mean that
    either you or I have to believe it.
    Big and Blue, Sep 21, 2005
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. vijay
    Replies:
    8
    Views:
    689
  2. Charles
    Replies:
    4
    Views:
    382
    Alf P. Steinbach
    Oct 7, 2005
  3. Roy
    Replies:
    6
    Views:
    577
    Roedy Green
    Jan 7, 2008
  4. Replies:
    1
    Views:
    79
    Brian Candler
    Feb 1, 2007
  5. Larry
    Replies:
    27
    Views:
    407
    Michele Dondi
    Jan 25, 2005
Loading...

Share This Page