Trouble installing the PHP PDO driver for MSSQL on Windows and Xampp

ITBenelux
ITBenelux used Ask the Experts™
on
Hello,

I'm having trouble connecting with MSSQL on Xampp/Windows
(dev local server connecting to a distant DB (MSSQL 2005)).

The following Connection string work fine :

'odbc:DRIVER={SQL Server}; SERVER=' . SQLSRV_IP . ',' . SQLSRV_PORT . ';DATABASE=' . SQLSRV_DBNAME

so I don't think it have anything to do with DB rights or firewall but

'mssql:host=' . SQLSRV_IP . ';dbname=' . SQLSRV_DBNAME, SQLSRV_USER, SQLSRV_PWD

give me the following error message : 'could not find driver'.

I've search the web and stumble upon the following link by MS (which I hope is the latest version)

http://www.microsoft.com/downloads/en/details.aspx?FamilyID=80e44913-24b4-4113-8807-caae6cf2ca05

I've installed the 4 .dll in /php/ext/ and added the following line in PHP.ini
extension=php_pdo_sqlsrv_53_ts_vc6.dll
extension=php_sqlsrv_53_ts_vc6.dll
but it still don't work (loading any other .dll give me various errors on apache startup)

Could someone tell me what I'm doing wrong or give me step by step instruction ?
I'm fairly new working with anything else than MySQL or PostgreSQL.

Thank you and kind regards.

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Fixer of Problems
Most Valuable Expert 2014
Commented:
There is a file called "SQLSRV_Help.chm" in that download.  In it are programming and formatting examples for all the drivers including PDO.  Under "System Requirements" on that page is a very brief mention of "Microsoft SQL Server 2008 R2 Native Client" which is Required to make the PHP drivers work.  You can download it from one of the links on http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=ceb4346f-657f-4d28-83f5-aae0c5c83d52   You have to scroll thru the page to find it.

I have used the previous version (1.1) and it worked fine but it didn't have PDO.

Author

Commented:
Thank you.

The following CS do work now :

sqlsrv:Server=' . SQLSRV_IP . ';Database=' . SQLSRV_DBNAME
Dave BaldwinFixer of Problems
Most Valuable Expert 2014

Commented:
Good, glad to help.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial