sjau
02-21-2004, 02:11 PM
Hiya,
I have a problem running a cgi on a server. The cgi-bin seems to work fine since the "hello.cgi" containing the following code prints out "Hello world" just fine:
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "Hello, world!\n";
However when I try to run the init.cgi script from JMBSoft's AutoGallery SQL I just get a 500 error.
Apache logs following error message:
[Sat Feb 21 13:12:57 2004] [error] 11736: ModPerl::Registry: Undefined subroutine &ModPerl::ROOT::ModPerl::Registry::var_www_perl_hgw_init_2ecgi::Error called at /var/www/perl/hgw/init.cgi line 26.!
Here's part of that init script:
#!/usr/bin/perl
##############################
## AutoGallery SQL v3.0.x ##
#######################################################
## init.cgi - Initialize the software installation ##
#######################################################
my $passed = 1;
my $dbh = undef;
my $cwd = `pwd`;
chomp($cwd);
eval
{
require 'common.pl';
require 'ags.pl';
Header("Content-type: text/html\n\n");
Main();
};
if( $@ )
{
Error("$@", 'init.cgi');
}
sub Main
{
ParseRequest();
if( -e "$ADIR/.htpasswd" )
{
ParseTemplate('init_done.tpl');
}
else
{
if( $F{'Username'} && $F{'Database'} )
{
eval("use DBI;");
## Attempt a connection to the MySQL server
$dbh = DBI->connect("DBI:mysql:$F{'Database'}:$F{'Hostname'}", $F{'Username'}, $F{'Password'}, {'PrintError$
## Connection failed
if( !$dbh )
{
HashToTemplate(\%F);
$T{'Error'} = DBI->errstr();
ParseTemplate('init_main.tpl');
}
## Connection established
if( !$dbh )
{
HashToTemplate(\%F);
$T{'Error'} = DBI->errstr();
ParseTemplate('init_main.tpl');
}
## Connection established
else
{
## Create database tables
CreateTables();
## Record settings in the variables file
RecordSettings();
## Setup the scanner.cgi and cron.cgi files
SetupScripts();
## Setup .htaccess password protection
SetupLogin();
$dbh->disconnect();
ParseTemplate('init_login.tpl');
}
}
else
{
## Run the tests
$T{'DBI'} = ModuleTest('DBI');
$T{'DBD'} = ModuleTest('DBD::mysql');
$T{'Templates'} = TemplatesTest();
$T{'Language'} = FileTest("$DDIR/language");
$T{'Scanner'} = FileTest("scanner.cgi");
$T{'Cron'} = FileTest("cron.cgi");
$T{'Admin'} = DirectoryTest($ADIR);
$T{'Data'} = DirectoryTest($DDIR);
## All tests passed
if( $passed )
{
$T{'Hostname'} = 'localhost';
ParseTemplate('init_main.tpl');
}
## One or more tests failed
else
{
ParseTemplate('init_test.tpl');
}
}
}
}
Anyone knows what's causing that error?
I have a problem running a cgi on a server. The cgi-bin seems to work fine since the "hello.cgi" containing the following code prints out "Hello world" just fine:
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "Hello, world!\n";
However when I try to run the init.cgi script from JMBSoft's AutoGallery SQL I just get a 500 error.
Apache logs following error message:
[Sat Feb 21 13:12:57 2004] [error] 11736: ModPerl::Registry: Undefined subroutine &ModPerl::ROOT::ModPerl::Registry::var_www_perl_hgw_init_2ecgi::Error called at /var/www/perl/hgw/init.cgi line 26.!
Here's part of that init script:
#!/usr/bin/perl
##############################
## AutoGallery SQL v3.0.x ##
#######################################################
## init.cgi - Initialize the software installation ##
#######################################################
my $passed = 1;
my $dbh = undef;
my $cwd = `pwd`;
chomp($cwd);
eval
{
require 'common.pl';
require 'ags.pl';
Header("Content-type: text/html\n\n");
Main();
};
if( $@ )
{
Error("$@", 'init.cgi');
}
sub Main
{
ParseRequest();
if( -e "$ADIR/.htpasswd" )
{
ParseTemplate('init_done.tpl');
}
else
{
if( $F{'Username'} && $F{'Database'} )
{
eval("use DBI;");
## Attempt a connection to the MySQL server
$dbh = DBI->connect("DBI:mysql:$F{'Database'}:$F{'Hostname'}", $F{'Username'}, $F{'Password'}, {'PrintError$
## Connection failed
if( !$dbh )
{
HashToTemplate(\%F);
$T{'Error'} = DBI->errstr();
ParseTemplate('init_main.tpl');
}
## Connection established
if( !$dbh )
{
HashToTemplate(\%F);
$T{'Error'} = DBI->errstr();
ParseTemplate('init_main.tpl');
}
## Connection established
else
{
## Create database tables
CreateTables();
## Record settings in the variables file
RecordSettings();
## Setup the scanner.cgi and cron.cgi files
SetupScripts();
## Setup .htaccess password protection
SetupLogin();
$dbh->disconnect();
ParseTemplate('init_login.tpl');
}
}
else
{
## Run the tests
$T{'DBI'} = ModuleTest('DBI');
$T{'DBD'} = ModuleTest('DBD::mysql');
$T{'Templates'} = TemplatesTest();
$T{'Language'} = FileTest("$DDIR/language");
$T{'Scanner'} = FileTest("scanner.cgi");
$T{'Cron'} = FileTest("cron.cgi");
$T{'Admin'} = DirectoryTest($ADIR);
$T{'Data'} = DirectoryTest($DDIR);
## All tests passed
if( $passed )
{
$T{'Hostname'} = 'localhost';
ParseTemplate('init_main.tpl');
}
## One or more tests failed
else
{
ParseTemplate('init_test.tpl');
}
}
}
}
Anyone knows what's causing that error?
