How to install sqlsrv driver on Pdo?

Asked

Viewed 157 times

0

How do I install or sqlsrv driver on Pdo?

<?php
function conectar(){

$pdo = null;
try {
    $opcoes = array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION);
    $pdo = new PDO("sqlsrv:server;host=192.168.0.30\COMPASS;dbname=weset;", "sa","Cabilog2015@", $opcoes);
} catch (Exception $e) {
    echo $e->getMessage();
}
return $pdo;
}

conectar();
?>

I’m getting this message in the browser:

could not find driver

  • In dsn PDO is mysl and you want to enable sqlsrv? After all SQL Server or Mysql?

  • 1

    I changed it. But I already did. I hadn’t disabled the php.ini dll

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.