I am not able to connect to the SQL server database through PHP. I already downloaded the correct driver for the PHP version (php_pdo_sqlsrv_54_ts.dll) and moved it to the ext folder, set up php.ini to load the driver (extension = php_pdo_sqlsrv_54_ts.dll) and nothing. PHP simply does not recognize the driver.
I use PHP 5.4.6 (installed via easyPHP v12.1 32bit) on a Windows 10 machine. According to phpinfo () PHP is configured as Thread Safety.
The following code always results in an exception error:
try {
$conn = new PDO("sqlsrv:server = tcp:ecardfid.database.windows.net,1433; Database = eCardFid", "eCardFid_DB", "##minha_senha##");
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
catch (PDOException $e) {
print("Error connecting to SQL Server.");
die(print_r($e));
}
Error connecting to SQL Server.PDOException Object ( [message:protected] => could not find driver [string:Exception:private] => [code:protected] => 0 [file:protected] => C:\Program Files (x86)\EasyPHP-12.1\www\testetree.php [line:protected] => 6 [trace:Exception:private] => Array ( [0] => Array ( [file] => C:\Program Files (x86)\EasyPHP-12.1\www\testetree.php [line] => 6 [function] => __construct [class] => PDO [type] => -> [args] => Array ( [0] => sqlsrv:server = tcp:ecardfid.database.windows.net,1433; Database = eCardFid [1] => eCardFid_DB [2] => proddbazure@2017 ) ) ) [previous:Exception:private] => [errorInfo] => ) 1
Would anyone know to tell me what I'm doing wrong?