Koozali.org formerly Contribs.org

cgi-bin "Internal Error"

Offline Ness

  • ***
  • 108
    • http://www.tapiochre.co.uk
cgi-bin "Internal Error"
« on: August 14, 2006, 04:31:37 PM »
I'm a SME 6.0.1 user

Am trying my best to integrate a few lines of perl that will let me have an email forms handler. No matter what I use as the shebang, I get an Internal Server Error when I submit the data to the script for processing (but it may not be anything to do with the shebang thing).

I have CHMODed the cgi file to 755, its CHOWN values are root:admin (only because I logged in as root to do the integration)

I have a virtual domain linked to an ibay.

I have enabled the cgi-bin facility for the ibay in question, put the email handler script )I called it postit.cgi) in the cgi-bin folder.

The HTML calls up the following action value:

Code: [Select]
<form action="http://www.mydomain.co.uk/cgi-bin/postit.cgi" method="post" name="MyForm">
...
inputs and submit stuff
</form>


The cgi script looks like this

Code: [Select]

#!/usr//bin/perl -w

use strict;
use CGI;

my $query = CGI->new();
my @names = $query->param;

my $noemail="";
my $from = $query->param('email');
if ($from eq ""){
$from = "noname\@mydomain.co.uk";
}else{
$from =~ s/@/\@/;
$noemail="true";
}

my $myself = "sales\@mydomain.co.uk";
open (MAIL, "|/usr/sbin/sendmail -t");
print MAIL "To: $myself \nFrom: $from\n";
my $subj = $query->param('subject');
if ($subj eq ""){
print MAIL "Subject: Form info entered\n";
}else{
print MAIL "Subject: " . $subj . "\n";
}

foreach my $name (@names){
    my @values = $query->param( $name );
if ((join ", ", @values) && ($name ne "subject") && ($name ne "email")){
print MAIL $name . " = " . (join ", ", @values) . "\n";
}
}
close (MAIL);

print $query->redirect("http://www.mydomain.co.uk/thankyou.html");



Can anyone spot where my problem lies? I've looked through my Apache book but have hit a bit of a dead end. The error message reads:

Code: [Select]
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, admin@tapiochre.co.uk 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.


but I see no evidence in the logs to  this problem, unless I'm looking in the wring place.


Chris
Chris Elliott - SME Server user and helper

Offline raem

  • *
  • 3,972
Re: cgi-bin "Internal Error"
« Reply #1 on: August 17, 2006, 12:48:26 PM »
Ness

> I'm a SME 6.0.1 user
> Am trying my best to integrate a few lines of perl that will let me have
> an email forms handler.

What about trying this, it generates the required files/code which you can use wherever.
http://tech-geeks.org/contrib/bbutts/phpFormGen/phpFormGen-php-2.07b.tar.gz
...

Offline Ness

  • ***
  • 108
    • http://www.tapiochre.co.uk
cgi-bin "Internal Error"
« Reply #2 on: August 17, 2006, 12:48:32 PM »
Decided to post to the General Discussion forum as this is "hopefully" not related to 6.0.1.

Chris
Chris Elliott - SME Server user and helper

Offline raem

  • *
  • 3,972
Re: cgi-bin "Internal Error"
« Reply #3 on: August 17, 2006, 12:51:13 PM »
Ness

> http://tech-geeks.org/contrib/bbutts/phpFormGen/phpFormGen-php-2.07b.tar.gz

Search around  for a newer version, there is at least a version
phpFormGen-php-2.09c.tar.gz
...

Offline Ness

  • ***
  • 108
    • http://www.tapiochre.co.uk
cgi-bin "Internal Error"
« Reply #4 on: August 17, 2006, 01:01:48 PM »
You're cookin' today Ray!

Thanks

Chris
Chris Elliott - SME Server user and helper

Offline raem

  • *
  • 3,972
cgi-bin "Internal Error"
« Reply #5 on: August 17, 2006, 01:18:27 PM »
Ness

> You're cookin' today Ray!

Yep, lukewarm one day, hot the next !!
...

Offline Ness

  • ***
  • 108
    • http://www.tapiochre.co.uk
cgi-bin "Internal Error"
« Reply #6 on: August 22, 2006, 10:26:34 AM »
Ray

Many thanks mate. I got hold of 2.09 and its done the job.

Cheers!

Chris
Chris Elliott - SME Server user and helper