Perl/CGI crew needed

Discussion in 'OT Technology' started by elevator, Apr 30, 2007.

  1. elevator

    elevator The tenants think it's wonderful! ヽ(´ OT Supporter

    Joined:
    Mar 25, 2005
    Messages:
    10,967
    Likes Received:
    0
    Location:
    Houston, TX
    So I am in this internet programming course and the assignment is to create a cgi script that converts Fahrenheit to Celisus, Celsius to Fahrenheit (depending on which radio button the user chooses) from data sent from a form. I keep getting Internal Error, 500 error when I fill out my form and submit it. Any suggestions?

    HTML Form
    Code:
     
    [SIZE=2]<HTML>
    <HEAD><TITLE>Daniel's Temperature Converter 1</TITLE>
    </HEAD>
    <BODY Background="background.gif">
    <form name="FORM" method="post" action="tempperl.cgi">
    <input type="text" name="degrees" size="10"><BR>
    <input type="radio" name="choices" value="F"> Convert to Fahrenheit<BR>
    <input type="radio" name="choices" value="C"> Convert to Celsius<BR>
    [/SIZE][FONT=Courier New][SIZE=2]<input type="submit" value="Submit">
    <input type="reset">
    [/SIZE][/FONT][SIZE=2]</form>
    </BODY></HTML>
    [/SIZE]
    cgi
    Code:
    [SIZE=2]#!/usr/bin/perl[/SIZE]
    [SIZE=2]print "Content-type: text/html\n\n";[/SIZE]
    [SIZE=2] 
    $deg = $FORM{$degrees);
    $FoC = $FORM{$choices);
    if ($FoC eq "F")
    {
    $out = (1.8 * $deg) +32;
    }
    else
    {
    $out = ($deg - 32) / 1.8;
    }
    print "<HTML>";
    print "<HEAD><TITLE>Daniel's Perl Temperature Conversion Results</TITLE>";
    print "</HEAD>";
    print "<BODY> $out </BODY>";
    print "</HTML>";
    [/SIZE]
     
  2. elevator

    elevator The tenants think it's wonderful! ヽ(´ OT Supporter

    Joined:
    Mar 25, 2005
    Messages:
    10,967
    Likes Received:
    0
    Location:
    Houston, TX
    where are the cgi'ers?
     
  3. Peyomp

    Peyomp New Member

    Joined:
    Jan 11, 2002
    Messages:
    14,017
    Likes Received:
    0
    tail /var/log/httpd/error_log

    The pathname may change. In the perl file insert the following lines near the top:

    use strict;
    use warnings;

    Apache will tell you the error in the error_log file. You can solve this yourself.

    www.catalyst.net
     
  4. Slid.

    Slid. I'm a guy.

    Joined:
    Oct 25, 2001
    Messages:
    1,928
    Likes Received:
    0
    Location:
    NH
    Sounds like the permissions aren't set properly for the .cgi file, I think it's 655, a Google Search would tell you for sure.
     
  5. Slid.

    Slid. I'm a guy.

    Joined:
    Oct 25, 2001
    Messages:
    1,928
    Likes Received:
    0
    Location:
    NH
    When I say permissions I mean CHMOD.
     

Share This Page