padutch 05-11-2009, 05:13 PM From the beginning. My website host is Hypermart.I am trying to install a classifieds script with MYSQL from Fuzzymonkey.com. The index.cgi uses sitevariables.pm for all paths and anything else it needs. The problem is that the script cannot find MYSQL.The scripts has the following snippit to call the MYSQL
if ($dbh = DBI->connect("dbi:mysql:$svb::mysqldb","$svb::mysqluser","$svb::mysqlpass"))
here is the error I get
[Mon May 4 07:53:12 2009] index.cgi: DBI connect('rlw.hypermartmysql.com','rlw',...) failed: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) at /home/users/web/b1263/hy.rlw/cgi-bin/class/index.cgi line 39
here are the settings for this line of code
our $mysqluser = 'rlw';
our $mysqlpass = 'deadly';
our $mysqldb = 'rlw.hypermartmysql.com'
when I am in MYSQL and have it generate a code it gives me the following
$db = DBI->connect('dbi:mysql:rlw:rlw.hypermartmysql.com:3306','rlw','deadly') or die('Couldnot connect');
I replaced the privious code with this changing $db to dbh and had a syntax error that I fixed and now I get
(https://protected.hypermart.net/rlw/cgi-bin/class/template.html): No such file or directory
am really new to this and need some help
Dutch
FishMonger 05-11-2009, 06:59 PM Contact your webhost. That is a mysql error that could have several causes, each of which requires the webserver admin. The mysql service may not be running, or there is a conflict in its config as to where to find the mysqld.sock file.
padutch 05-11-2009, 07:19 PM Contact your webhost. That is a mysql error that could have several causes, each of which requires the webserver admin. The mysql service may not be running, or there is a conflict in its config as to where to find the mysqld.sock file.
have contacted them and they ran a test and said that mysql is running. Although from what I can see they used php to access it.
<?php $con = mysql_connect("rlw.hypermartmysql.com","rlw","deadly"); if (!$con) { die('Could not connect: ' . mysql_error()); } echo "Connected successfully"; ?>
even so I used the same db the same user and the same password. so it should work for me.
FishMonger 05-11-2009, 09:12 PM If you're receiving the "Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' " error, but the test that your host performed didn't, then it's a permissions issue, which the webserver admin may need to correct.
Is the script running under strictures and warnings? Meaning, does it have these use statements?
use strict;
use warnings;
Does it also have this statement?
use CGI::Carp qw(fatalsToBrowser);
Can you post a more complete sample of your script and any/all warnings and errors that it produces?
padutch 05-11-2009, 10:09 PM If you're receiving the "Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' " error, but the test that your host performed didn't, then it's a permissions issue, which the webserver admin may need to correct.
Is the script running under strictures and warnings? Meaning, does it have these use statements?
use strict;
use warnings;
Does it also have this statement?
use CGI::Carp qw(fatalsToBrowser);
Can you post a more complete sample of your script and any/all warnings and errors that it produces?
have the permissions set right for the script if that is what you mean,
also have the [code]use strict; and [CODE]use CGI::Carp qw(fatalsToBrowser);
tried to attach the index.cgi but it will not let me
FishMonger 05-11-2009, 10:14 PM I was referring to the permissions on the database.
CF restricts the type and size of attachments.
Attach it as a zip file and keep it under 50k.
padutch 05-12-2009, 08:11 PM checked the permissions in the database and they are all set to yes, attached is the index.cgi ans the sitevariables.pm .hope this helps
kokjj87 05-13-2009, 07:29 PM #!/usr/bin/perl
use warnings;
use strict;
use CGI::Carp qw(fatalsToBrowser);
use CGI;
my $cgi = new CGI;
print $cgi->header;
print $cgi->start_html('Test');
##########################
my $database = "test";
my $host = "localhost";
my $username = "u";
my $password = "p";
##########################
use ExtUtils::Installed;
my $instmod = ExtUtils::Installed->new();
print "<b>Installed Module</b><br/>";
foreach my $module ($instmod->modules())
{
my $version = $instmod->version($module) || "???";
print "$module -- $version<br/>";
}
use DBI;
my @drivers;
@drivers = DBI->available_drivers();
print "<br/><br/><b>Here are a list of available drivers:</b><br/>";
foreach (@drivers)
{
print "$_ driver is available<br/>";
}
my $dsn = "dbi:mysql:database=$database;hostname=$host";
my %attr = (
PrintError => 0,
RaiseError => 0
);
#connect to database
my $dbh = DBI->connect($dsn, $username, $password, \%attr)
or die "Cannot connect to database: $DBI::errstr";
if($dbh)
{
print "<b>Database is fine.</b><br/>";
}
$dbh->disconnect();
print $cgi->end_html();
What about running this test on your host, make sure that you can see DBD::mysql in the install moule
padutch 05-14-2009, 09:12 PM #!/usr/bin/perl
use warnings;
use strict;
use CGI::Carp qw(fatalsToBrowser);
use CGI;
my $cgi = new CGI;
print $cgi->header;
print $cgi->start_html('Test');
##########################
my $database = "test";
my $host = "localhost";
my $username = "u";
my $password = "p";
##########################
use ExtUtils::Installed;
my $instmod = ExtUtils::Installed->new();
print "<b>Installed Module</b><br/>";
foreach my $module ($instmod->modules())
{
my $version = $instmod->version($module) || "???";
print "$module -- $version<br/>";
}
use DBI;
my @drivers;
@drivers = DBI->available_drivers();
print "<br/><br/><b>Here are a list of available drivers:</b><br/>";
foreach (@drivers)
{
print "$_ driver is available<br/>";
}
my $dsn = "dbi:mysql:database=$database;hostname=$host";
my %attr = (
PrintError => 0,
RaiseError => 0
);
#connect to database
my $dbh = DBI->connect($dsn, $username, $password, \%attr)
or die "Cannot connect to database: $DBI::errstr";
if($dbh)
{
print "<b>Database is fine.</b><br/>";
}
$dbh->disconnect();
print $cgi->end_html();
What about running this test on your host, make sure that you can see DBD::mysql in the install moule
that snippit worked just dandy. I used rlw and my password and it gave me a page full. Yes it has DBD::mysql .At the end it says Database is fine.
might my problem be with the way I set up my tables? I imported them from my desktop
padutch 05-15-2009, 06:49 PM My web host provides a Script Checker so I ran my index.cgi with it. here are the results,
Checked home/cgi-bin/class/index.cgi
[Fri May 15 13:34:05 2009] index.cgi: Can't locate common.pm in @INC
(@INC contains: ./lib /etc/perl /usr/local/lib/perl/5.8.8
/usr/local/share/perl/5.8.8 /usr/lib/perl5 /usr/share/perl5
/usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl/5.8.8
/usr/local/lib/site_perl /usr/local/lib/perl/5.8.4
/usr/local/share/perl/5.8.4 .) at
/home/users/web/b1263/hy.rlw/cgi-bin/class/index.cgi line 30.
[Fri May 15 13:34:05 2009] index.cgi: BEGIN failed--compilation
aborted at /home/users/web/b1263/hy.rlw/cgi-bin/class/index.cgi line
30.
Content-type: text/html
<h1>Software error:</h1>
<pre>Can't locate common.pm in @INC (@INC contains: ./lib /etc/perl
/usr/local/lib/perl/5.8.8 /usr/local/share/perl/5.8.8 /usr/lib/perl5
/usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8
/usr/local/lib/site_perl/5.8.8 /usr/local/lib/site_perl
/usr/local/lib/perl/5.8.4 /usr/local/share/perl/5.8.4 .) at
/home/users/web/b1263/hy.rlw/cgi-bin/class/index.cgi line 30.
BEGIN failed--compilation aborted at
/home/users/web/b1263/hy.rlw/cgi-bin/class/index.cgi line 30.
</pre>
<p>
Maybe you know what it is telling me.
FishMonger 05-16-2009, 12:09 AM Can't locate common.pm in @INC
Perl is telling that it can't find the common.pm module in any of the directories that it's configured for holding modules.
Do you have that file? If so, what is the exact path to that file?
Did the classifieds script from Fuzzymonkey.com come with a README or similar file that gives installation instructions. If so, did you follow those instructions exactly, or did you take some short cuts?
padutch 05-16-2009, 12:56 AM Perl is telling that it can't find the common.pm module in any of the directories that it's configured for holding modules.
Do you have that file? If so, what is the exact path to that file?
Did the classifieds script from Fuzzymonkey.com come with a README or similar file that gives installation instructions. If so, did you follow those instructions exactly, or did you take some short cuts?
FishMonger , followed the instructions to a T. and all permissions are set right.
https://protected.xxxxxxxxx.net/rlw/cgi-bin/class/lib/common.pm is where common.pm resides and yes it is there right where it is supposed to be. index is at https://protected.xxxxxxxxx.net/rlw/cgi-bin/class/index.cgi
I have installed other perl programs with little or no problem but this is the first using mysql
FishMonger 05-16-2009, 12:36 PM When I asked about the path to common.pm, I was referring to the system path, not a web url.
What is the exact system path of index.cgi and common.pm?
If you followed the installation instructions correctly, then I'd say that there is a bug/error in those instructions. Have you contacted the author of the script? Do they provide any support for their app?
|
|