Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Internal Server erro

DavidJackson4DavidJackson4 Posts: 33Member
I am trying to write a hello world Perl/CGI program.

When I go to the file on the web it says "Internal Server error"

I have already changed the permissions on helloworld.pl and I am pretty sure that I have the right #! line at the beginning. Any ideas what could be wrong?


Comments

  • XfactorXfactor Posts: 343Member
    [b][red]This message was edited by Xfactor at 2004-2-6 22:57:8[/red][/b][hr]
    : I am trying to write a hello world Perl/CGI program.
    :
    : When I go to the file on the web it says "Internal Server error"
    :
    : I have already changed the permissions on helloworld.pl and I am pretty sure that I have the right #! line at the beginning. Any ideas what could be wrong?

    We have to see your code but make sure you have the print statement:

    print "Content-type: text/html

    ";

    This needs to be placed before your other perl code. If this isn't the problem, you'll need to post your code.
  • JonathanJonathan Posts: 2,914Member
    : [b][red]This message was edited by Xfactor at 2004-2-6 22:57:8[/red][/b][hr]
    : : I am trying to write a hello world Perl/CGI program.
    : :
    : : When I go to the file on the web it says "Internal Server error"
    : :
    : : I have already changed the permissions on helloworld.pl and I am pretty sure that I have the right #! line at the beginning. Any ideas what could be wrong?
    :
    : We have to see your code but make sure you have the print statement:
    :
    : print "Content-type: text/html

    ";
    :
    : This needs to be placed before your other perl code. If this isn't the problem, you'll need to post your code.
    :
    Or more specifically, it has to be before any other print statement.

    Also, if you FTP'd the file up, make sure you did so in ASCII mode, otherwise you'll run into issues with different line endings, which also results in an Internal Server Error.

    Do you have access to the server's error log? If so, it can often provide valuable insight into the problem - just grep it for the name of your script (if you have that kinda access to it).

    Jonathan

    ###
    for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
    (tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
    /(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");

  • WeirdofreakWeirdofreak Posts: 439Member
    My first guess would be that the script isn't communicating with Perl. Telnet in, and try a whereis to be sure. The content-type thing should just mean that it displays as HTML, not plaintext - leave it out and you get the equivalent of a .txt file, which wouldn't be a problem with a simple hello world.
  • JonathanJonathan Posts: 2,914Member
    : The content-type thing should just mean that it displays as HTML,
    : not plaintext - leave it out and you get the equivalent of a .txt
    : file, which wouldn't be a problem with a simple hello world.
    :
    Sometimes yes, sometimes no. I've come accross a whole range of things that can happen if you don't add a valid header, including:-

    - Server supplies a text/html one so it displays as HTML
    - Server supplies a text/plain one so it displays as text
    - Server says "no headers, no play" and gives a 500 error

    I'm pretty sure I've seen all three of these happen accross various servers I've had the pleasure (or displeasure) of working with.

    Jonathan

    ###
    for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
    (tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
    /(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");

Sign In or Register to comment.