I recently started to learn PHP, and some of the things that I now encounter are connecting to the MSSQLS database. I found out on some well-cited websites that the most common (and best) way to use SQL DB with PHP is using PDO.
So this was what I have done so far:
1- Successfully installed drivers:
extension=php_sqlsrv_55_ts.dll
extension=php_pdo_sqlsrv_55_ts.dll
(I checked in phpinfo(), and my version of PHP is thread safe)
2- Drivers are recognized in phpinfo()
3- I keep getting this error:
4- Uncaught exception 'PDOException' with message 'SQLSTATE[IMSSP]: This extension requires the Microsoft SQL Server 2012 Native Client ODBC Driver to communicate with SQL Server.
Access the following URL to download the Microsoft SQL Server 2012 Native Client ODBC driver for x86: http://go.microsoft.com/fwlink/?LinkId=163712' in C:\xampp\htdocs\catala4\testdb.php:4 Stack trace: #0 C:\xampp\htdocs\catala4\testdb.php(4): PDO->__construct('sqlsrv:Server=H...', 'USER', 'PASSWORD') #1 {main} thrown in C:\xampp\htdocs\catala4\testdb.php on line 4
when executing this code:
<?php
include_once 'configs.php';
$mysqli = new PDO("sqlsrv:Server=HOST;Database=DATABASE", "USER", "PASSWORD");
I have no idea what is wrong, and I would like to help solve this problem, so my questions are:
- What is an ODBC driver? Is a driver required to connect to SQLS?
- , PDO , PDO - , , , , ?
- / ?
PHP v 5.5.9
