I'm trying to connect to my azure sql server database using PDO. But my code gives an error.
Error: could not find driver
My code:
$conn;
try {
$conn = new PDO("sqlsrv:Server=perslegt.database.windows.net,1433;Database=products", "serveradmin@perslegt", 'password');
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
catch(PDOException $e) {
echo "Error: " . $e->getMessage();
}
function dbClose(){
$conn = null;
}
I already allowed the ip addresses 000.000.000.000 to 255.255.255.255 in the firewall. But it gave the same error.