Hi All,
I am doing a connection to database from perl to mysql via apache. Apache is configured correctly.
Mysql username is root and password is mysql1, and database name is test.
when I type in url 127.0.0.1/cgi-bin/dbconn.pl, it showed internal server error 500. And errors in apache section a) below and errors in access. The samples table is created under test, residing in mysql database.
Tried to triple check and the configurations looks fine. Anyone can kindly assist? Thanks in advance
Andrew
dbconn.pl
I am doing a connection to database from perl to mysql via apache. Apache is configured correctly.
Mysql username is root and password is mysql1, and database name is test.
when I type in url 127.0.0.1/cgi-bin/dbconn.pl, it showed internal server error 500. And errors in apache section a) below and errors in access. The samples table is created under test, residing in mysql database.
Tried to triple check and the configurations looks fine. Anyone can kindly assist? Thanks in advance
Andrew
dbconn.pl
Code:
#!c:\perl\bin\perl.exe -w
#!/usr/bin/perl -w
use DBI;
$dbh = DBI->connect('dbi:mysql:test','root','mysql1')
or die "Connection Error: $DBI::errstr\n";
$sql = "select * from samples";
$sth = $dbh->prepare($sql);
$sth->execute
or die "SQL Error: $DBI::errstr\n";
while (@row = $sth->fetchrow_array) {
print "@row\n";
}
Code:
a) apache error log [Mon Oct 06 01:07:39 2008] [error] [client 127.0.0.1] Premature end of script headers: dbconn.pl [Mon Oct 06 01:07:39 2008] [error] [client 127.0.0.1] install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC (@INC contains: C:/perl/site/lib C:/perl/lib .) at (eval 4) line 3.\r [Mon Oct 06 01:07:39 2008] [error] [client 127.0.0.1] Perhaps the DBD::mysql perl module hasn't been fully installed,\r [Mon Oct 06 01:07:39 2008] [error] [client 127.0.0.1] or perhaps the capitalisation of 'mysql' isn't right.\r [Mon Oct 06 01:07:39 2008] [error] [client 127.0.0.1] Available drivers: CSV, DBM, ExampleP, File, Gofer, ODBC, Oracle, Proxy, SQLite, Sponge.\r [Mon Oct 06 01:07:39 2008] [error] [client 127.0.0.1] at D:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/dbconn.pl line 5\r
Comment