The server that has a cgi script does not have MySQL installed. MySQL is on another server on a different domain were the database is. I can't seem to get to the data base from the script. I have a configuration file that has the parameters and this cgi is call from the one that wants to access the database. Let me show you the two scripts, the first one is configure.pl as follows:
sub configure {
###############################
# CGI CONFIGURATION VARIABLES
###############################
$mailprogram = "/usr/sbin/sendmail -t";
$database = "matchpro";
$hostname = "mysql.rcrrich.com"; # added this
$port = "3306";
$mysqlusername = "name"; #just here for you
$mysqlpassword = "pass"; # not real use or pass
This is just the part that is supposed to call MySQL and open the database matchpro when called from the other scripts. All the scripts call this one file to get many of the perameters. Now the next script is the one that gets the info to add to the database matchpro. This one is called add.pl
#!/usr/bin/perl -s
use Socket;
require "configure.pl";
&configure;
open (HEADERHTML, "$headerhtml");
@header = <HEADERHTML>;
close HEADERHTML;
open (FOOTERHTML, "$footerhtml");
@footer = <FOOTERHTML>;
close FOOTERHTML;
$orderid = &generateorderid;
$profilenumber = $orderid;
&form_parse;
$AdHeadline = $FORM{'AdHeadline'};
$EmailAddress = $FORM{'EmailAddress'};
$TelephoneAreaCode = $FORM{'TelephoneAreaCode'};
$City = $FORM{'City'};
$StateProvince = $FORM{'StateProvince'};
$Zip = $FORM{'Zip'};
$Country = $FORM{'Country'};
$RelationshipPreference = $FORM{'RelationshipPreference'};
$SexualPreference = $FORM{'SexualPreference'};
$Username = $FORM{'Username'};
$Password = $FORM{'Password'};
$VerifyPassword = $FORM{'VerifyPassword'};
$SmokingPreference = $FORM{'SmokingPreference'};
$DrinkingPreference = $FORM{'DrinkingPreference'};
$MaritialStatus = $FORM{'MaritialStatus'};
$HaveChildren = $FORM{'HaveChildren'};
$BodyBuild = $FORM{'BodyBuild'};
$Height = $FORM{'Height'};
$Religion = $FORM{'Religion'};
$Race = $FORM{'Race'};
$AstrologicalSign = $FORM{'AstrologicalSign'};
$Age = $FORM{'Age'};
$Occupation = $FORM{'Occupation'};
$MiscComments = $FORM{'MiscComments'};
$MiscComments =~ s/ /\|/g;
$MiscComments =~ s/\s/\|/g;
$MiscComments =~ s/\|+/ /g;
use DBI;
$dbh = DBI->connect("DBI:mysql:$database:$hostname:$port, "$mysqlusername", "$mysqlpassword") or die "Unable to connect to Data: $dbh->errstr\n");
print "Content-type: text/html\n\n";
&printheader;
&errcheck;
&checkuniqueusernames;
&checkuniqueemails;
&savedata;
&printconfirmation;
&printfooter;
&emailmember;
$dbh->disconnect;
If I # out the $dbh = DBI->connect........
the script starts to work, so it seems that as soon as the script reachs $dbh it crashes with a 500 error
Can anyone help or is this not possible??
rexxx
rexxx webmaster
sub configure {
###############################
# CGI CONFIGURATION VARIABLES
###############################
$mailprogram = "/usr/sbin/sendmail -t";
$database = "matchpro";
$hostname = "mysql.rcrrich.com"; # added this
$port = "3306";
$mysqlusername = "name"; #just here for you
$mysqlpassword = "pass"; # not real use or pass
This is just the part that is supposed to call MySQL and open the database matchpro when called from the other scripts. All the scripts call this one file to get many of the perameters. Now the next script is the one that gets the info to add to the database matchpro. This one is called add.pl
#!/usr/bin/perl -s
use Socket;
require "configure.pl";
&configure;
open (HEADERHTML, "$headerhtml");
@header = <HEADERHTML>;
close HEADERHTML;
open (FOOTERHTML, "$footerhtml");
@footer = <FOOTERHTML>;
close FOOTERHTML;
$orderid = &generateorderid;
$profilenumber = $orderid;
&form_parse;
$AdHeadline = $FORM{'AdHeadline'};
$EmailAddress = $FORM{'EmailAddress'};
$TelephoneAreaCode = $FORM{'TelephoneAreaCode'};
$City = $FORM{'City'};
$StateProvince = $FORM{'StateProvince'};
$Zip = $FORM{'Zip'};
$Country = $FORM{'Country'};
$RelationshipPreference = $FORM{'RelationshipPreference'};
$SexualPreference = $FORM{'SexualPreference'};
$Username = $FORM{'Username'};
$Password = $FORM{'Password'};
$VerifyPassword = $FORM{'VerifyPassword'};
$SmokingPreference = $FORM{'SmokingPreference'};
$DrinkingPreference = $FORM{'DrinkingPreference'};
$MaritialStatus = $FORM{'MaritialStatus'};
$HaveChildren = $FORM{'HaveChildren'};
$BodyBuild = $FORM{'BodyBuild'};
$Height = $FORM{'Height'};
$Religion = $FORM{'Religion'};
$Race = $FORM{'Race'};
$AstrologicalSign = $FORM{'AstrologicalSign'};
$Age = $FORM{'Age'};
$Occupation = $FORM{'Occupation'};
$MiscComments = $FORM{'MiscComments'};
$MiscComments =~ s/ /\|/g;
$MiscComments =~ s/\s/\|/g;
$MiscComments =~ s/\|+/ /g;
use DBI;
$dbh = DBI->connect("DBI:mysql:$database:$hostname:$port, "$mysqlusername", "$mysqlpassword") or die "Unable to connect to Data: $dbh->errstr\n");
print "Content-type: text/html\n\n";
&printheader;
&errcheck;
&checkuniqueusernames;
&checkuniqueemails;
&savedata;
&printconfirmation;
&printfooter;
&emailmember;
$dbh->disconnect;
If I # out the $dbh = DBI->connect........
the script starts to work, so it seems that as soon as the script reachs $dbh it crashes with a 500 error
Can anyone help or is this not possible??
rexxx
rexxx webmaster