31 users online (0 members and 31 guests)  


  Results 1 to 10 of 10

Related

  1. Replies: 0
  2. 500 internal server error    Forum: CGI Perl Forum
    Replies: 1
  3. iframe - internal server error    Forum: HTML Forum
    Replies: 1
  4. Replies: 0
  1. #1
    atomickitty's Avatar
    New User

    Status
    Offline
    Join Date
    Jan 2005
    Posts
    4

    Internal Server Error?

    Hi there,
    I'm attempting to start learning Perl/CGI because I'm in need of a good database content management system and .php is just not cutting it for me anymore. After several hours of search I found a book that looked like it would be helpful and set out to start testing my first script, the code for which I got from my book. The script is supposed to be 'self-contained' and all I supposedly needed to do was save it as a text file and upload it to my server. After doing this I looked at the page and was suprised to see that instead of my woefully simple script it contained the following error message:
    Internal Server Error
    The server encountered an internal error or misconfiguration and was unable to complete your request.

    Please contact the server administrator, webmaster@atomic-kitty.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

    More information about this error may be available in the server error log.

    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
    Apache/1.3.33 Server at www.atomic-kitty.com Port 80
    I have no idea what's wrong! My server (hosted by site5.com) has Perl installed and it's a recent version The permissions for the script were set at 755, so it should be executable by anyone.

    The script is a very simple one, all it does is take a name entered in a text box and plug it back into an answer. After two hours of search neither I, nor anyone I know, could figure out what was wrong... any suggestions? Please feel free to IM me or post if you have any advice.

  2. #2
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    Perl by default writes the actual errors to your web log. If you have access to these (ftp, or control panel) you can check in there first.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  3. #3
    atomickitty's Avatar
    New User

    Status
    Offline
    Join Date
    Jan 2005
    Posts
    4
    Yes, I know. I checked the error logs but still can't figure out the problem. These are the errors I get:

    [Fri Jan 7 16:48:40 2005] [error] [client 67.41.230.149] File does not exist: /home/atomicki/public_html/500.shtml
    [Fri Jan 7 16:48:40 2005] [error] [client 67.41.230.149] Premature end of script headers: /home/atomicki/public_html/cgi-bin/first.cgi
    [Fri Jan 7 16:48:38 2005] [error] [client 67.41.230.149] File does not exist: /home/atomicki/public_html/500.shtml
    [Fri Jan 7 16:48:38 2005] [error] [client 67.41.230.149] Premature end of script headers: /home/atomicki/public_html/cgi-bin/first.cgi
    I'm not sure why it claims a file doesn't exist. Any other advice?

  4. #4
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    Ignore the non-existant file, it means theres no custom error page for error 500.

    First, make sure its uploaded in ASCII not binary. If that doesn't work post the script here. Can't fix it without seeing the script, because that error is generic and could mean a lot of things.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  5. #5
    atomickitty's Avatar
    New User

    Status
    Offline
    Join Date
    Jan 2005
    Posts
    4
    As far as I can tell it's not been uploaded in ASCII (it's information on my file manager states that is an ASCII file). The code is;

    # first.cgi

    #!/usr/bin/perl -w

    use CGI; # import the CGI.pm module

    $q = new CGI; # create a new CGI object, $q,
    # which will automatically read
    # any input and format it for
    # easy access.

    $self = $q->url; # and get our own url

    # start the page by printing a standard
    # HTTP header ("Content-type: text/html")
    print $q->header;
    # If we've gotten some input, display the result page.
    # Otherwise, display the input form.
    if ($q->param){

    # Make the name look nice by capitalizing the
    # first letter
    $name = ucfirst( $q->param('name') );

    # This is a 'here document': everything down to the
    # label specified (in this case, 'HTML') will be
    # printed. The closing HTML label must be the first
    # word on its line.
    print <<HTML;
    <html>
    <head>
    <title>My First CGI</title>
    </head>

    <body>
    <h1>My First CGI</h1>

    <p>Hello, $name! This is my first CGI!</p>

    </body>
    </html>

    HTML

    } else {

    # Another 'here document' -- note that
    # it's not a good idea to have two with the
    # same label in one script.
    print <<FORM;
    <html>
    <head>
    <title>What's your name?</title>
    </head>

    <body>
    <h1>What is your name?</h1>

    <form action="$self" method="post">
    <p>Your name: <input type="text" name="name"/></p>
    <p><input type="submit"/></p>
    </form>

    </body>
    </html>

    FORM

    }
    I hope it isn't something silly.. I tried to exhaust all other options before asking for help.

  6. #6
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    Its okay, your allowed to ask

    We really need to make sure the file was uploaded in ASCII Mode. This is not the same as being an ASCII file, causes much confusion. How did you upload it? Was it via an FTP client? If so, try uoploading again and watch the status screen for 'Uploading in ASCII' to make sure it is correctly uploading.

    Your script needs to send out a header (see the script, it explains) but it is erroring BEFORE it sends the headers.

    Its relying on CGI.pm (pm=Perl Module) for the headers, is this installed? (It probably is, but we need to check)

    Please check those then we can move forward.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  7. #7
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    oh, and of course you need to make sure your path to Perl (the top line) is correct. and that needs to be the very first line in the script. You can check Perl in your control panel.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  8. #8
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    I just tried it on my test server, would not work until I removed everything before

    Code:
    #!/usr/bin/perl -w
    If thats the very first line in the file, and it has correct permissions, it should work for you.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  9. #9
    atomickitty's Avatar
    New User

    Status
    Offline
    Join Date
    Jan 2005
    Posts
    4
    Thank you so much! I backtracked and made sure all of the paths were correct etc. and it still wouldn't work - and then I took off the # first.cgi that was placed above the path to Perl and presto!

    Thanks again.. I'll probably be back for me help sooner or later.

  10. #10
    shahzad79's Avatar
    New User

    Status
    Offline
    Join Date
    Dec 2010
    Posts
    2

    Re: Internal Server Error?

    Hi,

    I need a quick help from GURUs of PERL.

    I moved a website to a new location and got an error "Internal Server Error" instead of specific error. As i don't know PERL so i don't know how to fix it.

    Can anybody help me to fix this error or to generate a specific error which i can understand as "Internal Server Errror" is not understandable for me.

    Need some quick help from you guys


    Thanks,
    Shahzad



Tags for this Thread