I've installed xampp on my computer. When I try to connect it tells me
Error!: could not find driver
When I run my code on my webhost, it works.
Some info:
XAMPP 3.2.2
MSSQL Server 2012
I connect with the following code:
define("USER_NAME", "myusername");
define("DATABASE", "mydatabase");
define("PASSWORD", "mypassword");
define("HOST", "myhost");
try{
$db = new PDO("dblib:host=".HOST.";dbname=".DATABASE, USER_NAME, PASSWORD);
$db->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
}catch(PDOException $exception){
echo $exception->getMessage();
exit;
}
I've downloaded these files, dropped them in the ext folder and added the following lines to php.ini:
extension=php_dblib.dll
extension=php_sqlsrv_54_ts.dll
extension=php_pdo_sqlsrv_54_ts.dll