Reputation: 267
I have recently starting to learn PHP, and a few things I'm struggling now is the connection to a MSSQLS database. I learned in some well quoted websites that the most common (and best) way for using a SQL DB with PHP is using PDO.
So, this was what I have done so far:
1- Successfully installed the drivers:
extension=php_sqlsrv_55_ts.dll
extension=php_pdo_sqlsrv_55_ts.dll
(I have checked in phpinfo()
, and my version of PHP is thread safe)
2- Drivers are recognized in the 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 some help solving this issue, so my questions are:
USING PHP v 5.5.9
Upvotes: 4
Views: 16899
Reputation: 1361
You've just to install MS ODBC Driver 11 for SQL Server from this link
Upvotes: 0
Reputation: 1
To fix this same issue i downloaded from
http://www.microsoft.com/es-ar/download/details.aspx?id=35580
click on Download and select the package
sqlncli.msi
which is exactly what is missing.
Hope it helps, worked for me. =)
Xampp 1.8.3-3, PHP 5.5.9, same as you
Upvotes: 0
Reputation: 45490
Yes, it is . Please read up on ODBC
wrong ODBC is the middelware.
Problem: Driver is not installed.
Solution: Download and install ODBC driver.
Upvotes: 4