Perl - MySQL connection problem in windows
- by dexter
I have two folders php and perl they contain index.php and index.pl respectivly
in index.pl
my perl code looks like:
#!/usr/bin/perl
use Mysql;
print "Content-type: text/html\n\n";
print "<h2>PERL-mySQL Connect</h2>";
print "page info";
$host = "localhost";
$database = "cdcol";
$user = "root";
$password = "";
$db = Mysql->connect($host, $database, $user, $password);
$db->selectdb($database);
when i run above code (ie type: http://localhost:88/perl/ in browser)
following error comes
Error message:
Can't locate Mysql.pm in @INC (@INC contains: C:/xampp/perl/site/lib/ C:/xampp/perl/lib C:/xampp/perl/site/lib C:/xampp/apache) at C:/xampp/htdocs/perl/index.pl line 2. BEGIN failed--compilation aborted at C:/xampp/htdocs/perl/index.pl line 2.
while this works:
in browser http://localhost:88/php/
where index.php has:
<?php
$con = mysql_connect("localhost","root","");
if($con)
{
if(mysql_select_db("cdcol", $con))
{
$sql="SELECT Id From products";
if(mysql_query($sql))
{
$result = mysql_query($sql);
if ($result)............