I want to run Microsoft Access Database using PDO_ODBC
(on Centos 7 x64 bit). But unfortunately i get this error on the page :
could not find driver
First of all i am looking the problem through my connection.php, but seems like there is no problem in my code (tested on Windows 7 x64 bit).
And then i think the driver has not enabled yet, i look into phpinfo()
page and yes the driver has not enabled yet.
And then i go into php.ini to enable the driver. I uncomment the following line in php.ini:
extension=pdo_odbc
And then i restart the apache using this command:
# /etc/init.d/apache2 restart
After that i look into phpinfo()
page, unfortunately the setting that i have set has not enabled yet, this is the screenshot for the phpinfo()
:
phpinfo() page.
Would you tell me how to enable PDO_ODBC on Linux (CentOS 7)?
UPDATE TO SHOW MY CONNECTION
connection.php:
<?php
$dsn = "{Microsoft Access Driver (*.mdb, *.accdb)}";
$db = "/home/www/html/cetak_absensi/uploaded/db_access/my_access_db.mdb";
$user = "";
$pass = "";
if (!file_exists($db)) {
die("File is not exists ! " . $db);
}else{
try {
$koneksi = new PDO("odbc:DRIVER=".$dsn.";charset=UTF-8; Dbq=".$db."; Uid=".$user."; Pwd=".$pass.";");
$koneksi->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) {
echo "There is an error : <i>" . $e->getMessage() . "</i>";
die();
}
}