[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

Problem with Perl script?

Posted on 1999-10-31
3
Medium Priority
?
348 Views
Last Modified: 2010-03-05
I keep getting this error but when I tested it and developed in in Windows NT using IIS4 and Active Perl 5.0 it worked great.  Now i uploaded it to earthlink that host the domain site and I had them turn on the perl script and I keep getting the following error:
HTTP 500 Internal Server error
 The page cannot be displayed
There is a problem with the page you are trying to reach and it cannot be displayed.

Can anyone see what could be causing this?

Thanks

/** registration.htm file

      <FORM ACTION="http://www.interactdatabase.com/sem_registration/reg.pl" METHOD="POST" NAME="frmRegistration" OnSubmit="return validation()">



/** reg.pl file below

#!/usr/local/bin/perl
use CGI;

$query = new CGI;

open( FILEIO, ">>reg.txt" ) or
      die( "Cannot open reg.txt file" );

$delm = ",";
$qt = "'";
$fname             = $query->param('firstName');
$lname             = $query->param('lastName');
$title            = $query->param('title');
$badge            = $query->param('badge');
$company      = $query->param('company');
$address      = $query->param('address');
$city            = $query->param('city');
$state            = $query->param('state');
$country      = $query->param('country');
$zip            = $query->param('zip');
$email            = $query->param('email');
$phone            = $query->param('phone');
$fax            = $query->param('fax');
$NovEvent      = $query->param('nov_date');
$DecEvent      = $query->param('dec_date');
$cust            = $query->param('cus_sel');
$sales            = $query->param('sales_sel');
$call            = $query->param('call_sel');
$fin            = $query->param('fin_sel');
$buss            = $query->param('buss_sel');
$supp            = $query->param('sup_sel');
$entr            = $query->param('entr_sel');
$hear            = $query->param('hearSem');
$hear_other      = $query->param('hearSem_Other');
$rep            = $query->param('rep_name');

$fromEmail     = "eric@earthlink.net";
$emailSubject = "Tesitng";
$emailMessage = "Thank you for respondeing\n To use";

if( !$badge )
{
      $badge = $lname . "," . $fname;
}

$event = "";

if( $NovEvent && $DecEvent)
{
      $event = "Nov" . "," . "Dec";
}
elsif( $NovEvent && !$DecEvent )
{
      $event = "Nov";
}
elsif( $DecEvent && !$NovEvent )
{
      $event = "Dec";
}

if( $cust )
{
      $cust = "Customer Relationship Management = yes";
}
else
{
      $cust = "Customer Relationship Management = no";
}

if( $sales )
{
      $sales = "Sales/Marketing = yes";
}
else
{
      $sales = "Sales/Marketing = no";
}

if( $call )
{
      $call = "Call Center = yes";
}
else
{
      $call = "Call Center = no";
}

if( $fin )
{
      $fin = "Financials = yes";
}
else
{
      $fin = "Financials = no";
}

if( $buss )
{
      $buss = "Business Intelligience = yes";
}
else
{
      $buss = "Business Intelligience = no";
}

if( $supp )
{
      $supp = "Customer Service And Support = yes";
}
else
{
      $supp = "Customer Service And Support = no";
}

if( $entr )
{
      $entr = "Enterprise Resource Planning = yes";
}
else
{
      $entr = "Enterprise Resource Planning = no";
}


if( $hear == 0 )
{
      $hear = "Direct Mail";
}
elsif( $hear == 1 )
{
      $hear = "Telemarketing";
}
elsif( $hear == 2 )
{
      $hear = "Web Site";
}
elsif( $hear == 3 )
{
      $hear = "Other: " . $hear_other;
}


print FILEIO "'", $fname, "'", ",",
             "'", $lname, "'", ",",
             "'", $title, "'", ",",
             "'", $badge, "'", ",",
             "'", $company, "'", ",",
             "'", $address, "'", ",",
             "'", $city, "'", ",",
             "'", $state, "'", ",",
             "'", $country, "'", ",",
             "'", $zip, "'", ",",
             "'", $email, "'", ",",
             "'", $phone, "'", ",",
             "'", $fax, "'", ",",
             "'", $event, "'", ",",
             "'", $cust, "'", ",",
             "'", $sales, "'", ",",
             "'", $call, "'", ",",
             "'", $fin, "'", ",",
             "'", $buss, "'", ",",
             "'", $supp, "'", ",",
             "'", $entr, "'", ",",
             "'", $hear, "'", ",",
             "'", $rep, "'", "\n";
                        

close( FILEIO );


print <<'EOT';
Location: http://www.interactdatabase.com/

EOT
0
Comment
Question by:eric07
3 Comments
 
LVL 85

Expert Comment

by:ozo
ID: 2173379
What error are you getting in the server error log?
Did it complain about writing "@earthlink" as "\@earthlink" in
$fromEmail     = "eric@earthlink.net"; ?
do you die( "Cannot open reg.txt file" )?
is EOT the only thing on the line with no extra blanks around it?
0
 

Expert Comment

by:ralp
ID: 2174312
A couple of things.

The double quotes around your email address "eric@erathlink.net" will allow perl to try to use @earthlink as an array, this is now a compile bug. Try using single quotes or escaping the @ sign as "eric\@erathlink.net".

Also a run time error could be that it can't write the reg.txt due to permission problems.

For CGI scripts it's best to add some debugging to the script.
such as before you really do anything, redirect STDERR to STDOUT such as

open(STDERR, ">&STDOUT");

$query = new CGI;
print $query->headers, $query->start_html;

and then all your error messages will come out in the browswer  so when you do have a run time error you'll see when and where it is... This way you won't need access to the web server's error_log.
0
 

Accepted Solution

by:
ramvinod earned 100 total points
ID: 2175322
location of perl maynot be /usr/local/bin.

i just tried it, if you dont specify path to perl properly it gives 500 Internal Server Error. if it isnt able to write to a file, it doesn't complain at all. (it == perl script.)
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans
Suggested Courses

590 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question