SQL Server 2012 with PHP 5.4 on Windows 7

To connect your PHP 5.4 application to SQL Server 2012 database. I assume you have PHP 5.4 installed through Wamp Server ( 32 bit ) 

1. Download ans install MS SQL SERVER PDO Driver

To download this driver, follow instructions provided on following link.

http://www.microsoft.com/en-in/download/details.aspx?id=20098

Extract it and move following DLL files

to path-to-your-xamp-installation/php

Then we need to tell apache to load these DLLs, for this we will edit php.ini file present in wamp\bin\apache\Apache2.4.4\bin\php.ini file. Add following two lines

2. Microsoft Sql Server 2012 SP1 Feature Pack

To download and install this, visit following link

http://www.microsoft.com/en-in/download/details.aspx?id=35580

You will get a sqlncli.msi file, double click on this to install it.

Now just restart your wamp server, to load these changes.  If you want to confirm if these changes have been applied. Create a phpinfo.php file in your web server root directory. Add following code in this file.

You should see this somewhere in the result.

MSSQL SERVER PDO MS SQL SERVER

To connect and get records from the database table.

Hope you find this article useful.