--- loncom/build/system_dependencies/sqltest.pl 2001/09/30 20:57:58 1.1 +++ loncom/build/system_dependencies/sqltest.pl 2002/05/16 19:03:56 1.5 @@ -6,7 +6,8 @@ # # YEAR=2001 # 9/25,9/30 Scott Harrison -# +# YEAR=2002 +# 5/10,5/11 Scott Harrison ############################################################################### ## ## @@ -38,7 +39,7 @@ use DBI; # ---------------------------- Print MIME Content-type and other initialization $|=1; -print 'Content-type: text/plain'."\n\n"; +print 'Probing for SQL metadata database'."\n\n"; # --- Make sure that database can be accessed and that this is a library server # library server test @@ -46,7 +47,27 @@ my %perlvar; open (CONFIG,"/etc/httpd/conf/access.conf") || (print "Can't read access.conf\n" && exit); while (my $configline=) { - if ($configline =~ /PerlSetVar/) { + if ($configline =~ /^[^\#]*PerlSetVar/) { + my ($dummy,$varname,$varvalue)=split(/\s+/,$configline); + chomp($varvalue); + $perlvar{$varname}=$varvalue; + } +} +close(CONFIG); +open (CONFIG,"/etc/httpd/conf/loncapa.conf") || + (print "Can't read loncapa.conf\n" && exit); +while (my $configline=) { + if ($configline =~ /^[^\#]*PerlSetVar/) { + my ($dummy,$varname,$varvalue)=split(/\s+/,$configline); + chomp($varvalue); + $perlvar{$varname}=$varvalue; + } +} +close(CONFIG); +open (CONFIG,"/etc/httpd/conf/loncapa_apache.conf") || + (print "Can't read loncapa_apache.conf\n" && exit); +while (my $configline=) { + if ($configline =~ /^[^\#]*PerlSetVar/) { my ($dummy,$varname,$varvalue)=split(/\s+/,$configline); chomp($varvalue); $perlvar{$varname}=$varvalue; @@ -66,10 +87,66 @@ my $dbh; { RaiseError =>0,PrintError=>0}) ) { print "Cannot connect to database!\n"; + my $checkDBImodule=`perl pmvers DBI 2>/dev/null`; + my $checkMYSQLmodule=`perl pmvers Mysql 2>/dev/null`; + my $checkprocess=`/etc/rc.d/init.d/mysqld status`; + if (!$checkDBImodule) { + print "**** ERROR **** SYSTEM IS MISSING THE DBI PERL ". + "MODULE (DBI.pm)\n"; + } + elsif (!$checkMYSQLmodule) { + print "**** ERROR **** SYSTEM IS MISSING THE MYSQL PERL ". + "MODULE (Mysql.pm)\n"; + } + elsif (!-e '/etc/rc.d/init.d/mysqld') { + print "**** ERROR **** IT APPEARS THAT THE MYSQL SERVER HAS NOT ". + "BEEN INSTALLED\n"; + } + elsif ($checkprocess=~/is stopped/) { + print "**** ERROR **** IT APPEARS THAT THE MYSQL SERVER IS NOT ". + "RUNNING\n"; + print(< delete from user where user='www' +And then, you will need to repeat the MySQL configuration steps described at: + http://install.lon-capa.org/. + +**** NOTE **** ANOTHER possibility is that you are not running +a compatible set of DBI, Mysql perl modules and MySQL server software. +END + } exit 1; } } %perlvar=(); # undefine it +print "SQL metadata database is found and is accessible\n"; + # --------------------------------------------------- Close database connection $dbh->disconnect();