Xampp WordPress Database Connection Error

…::Learning is a continous process.

Visit us on: www.techwiz.co.ke call 0715990548

How to Install SQLSRV Drivers on XAMPP

“Once we accept our limits, we go beyond them.”

Install SQLSRV Drivers on XAMPP

-XAMPP Installation File

-PHP SQLSRV Drivers.

Its been a while since i Did a Post on This Page, but whenever i embark on doing something i do it for the betterment of those with no Idea or Those who are Stuck like me (Past Tense Now) on a certain Issue. Today i will Guide most of you who have an issue installing SQLSRV Drivers on XAMPP. Why specifically SQLSRV? You may Ask.


Few days Ago (Based on the Initial Date of Writing this Blog Entry) i wanted to work on a certain project that involved Making constant Connections to an SQL Driven Database. But whenever i tried using the basin DSN Connection setup using PDO it always ended up with an exception untill i realized the problem was the Drivers. So this was the Basic connection parameters i was using on php

$dsn = new pdo(“sqlsrv:host=$host;dbname=$database_name,”$username,$password,array(ATTR_EMULATES_PREPARE=>false,ATTR_ERRMODE=>PDO::ERRMODE_EXCEPTION);

i will not demistify this connection string but the point to note is after declaring the function new pdo the first parameter is what we are supposed to be concerned i was using mysql beforehand but this time round when trying to use sqlsrv i always got an exception.

Looking at my phpinfo it showed i didnt have sqlsrv specified anywhere. (BTW Those of you who do not know how to check their phpinfo this is how we go about it)

Fire Up your Local based server XAMPP or WAMP depending on your specifictions . create a php file and name it info.php or whatever way you want… paste this code or just write this code

it should bring up the following output Take Note of the Field PDO

as you have seen we only have two drivers installed mysql,sqlite.


we will be performing a few Procedures to Get sqlsrv drivers to work with XAMPP


1. Re Install the Version of XAMPP That you were Using and Download a Fresh Installation I used this Link

2. Download the Following SQLSRV Drivers for PHP NB: You should Know the Version of PHP you are using in my case my php version was 5.6 so in the drivers you will only use the driver php_sqlsrv_56_ts.dll

Please Note: the End Initials _ts and _nts Once you download the PHPSQLSRV Drivers.

_ts means Thread Safe.

_nts means Non Thread Safe. the Differences are in the way servers handle Incoming HTTP Requests. More info Here ==> http://stackoverflow.com/questions/1623914/what-is-thread-safe-or-non-thread-safe-in-php

Download and extract the drivers to C:\xampp\php\ext This is the default Folder xampp creates on the Local Disk…

3. On XAMPP Control Panel Click on Config Under Apache and Click on php.ini Option.

-Locate the Extension statement and add the driver version based on your php version

Location Of SQL Driver on PHP Extension Folder

insert the Following Comment on the php.ini File

Edit the Comment on the php.ini File

Save the File and Stop the Apache Service.

4. Next we are Going to Run the Changes we have Made to the ini file in order for the settings to take Place.

Launch Up Command Prompt and Type in the Following Command.

You will see the php version i am using and why i was Stressing you specify the driver thing either 55,53,54,56 but in my case i used 56 since my version was 5.6 i Hope you get the Point im stressing here..

Command To Run to effect changes

Now after successfully running the command check on the Following Output on the CMD Command Line

Check whether you will Find the SQLSRV Driver Entry check image Below:

Installed SQLSRV Drivers

Friends this was Awesome Discovering this On my Own after Countless Times on StackOverflow provided a very Complex Solution and other solutions on the internet but i wanted a less stress free way of Consuming this and Also Regurgitating it back to you in a simplified way. I simply had to do this incase you need a blog for any other type of Problem to be Solved. Feel Free to contact me. I hope you guys enjoyed this.

Leave a Reply

Your email address will not be published. Required fields are marked *