MSSQL PDO could not find driver
Not sure if this is due to running a CentOS x86_64 machine but sqlsrv
didn't work as the driver for me, I had to use dblib
:
try {
$DBH = new PDO("dblib:host=xxxx;dbname=xxxx", 'xxxx', 'xxxx');
} catch (PDOException $e) {
echo $e->getMessage();
}
Source and thanks to.
mssql
is the old way of doing it, sqlsrv
should be more appropriate! In fact the extension is called (extension=php_pdo_sqlsrv_53_ts_vc9.dll) as well ;)
try {
$DBH = new PDO("sqlsrv:Server=xxxx;Database=xxxx", 'xxxx', 'xxxx');
} catch (PDOException $e) {
echo $e->getMessage();
}
Hope this helps!
Source : http://php.net/manual/fr/ref.pdo-sqlsrv.connection.php