Best Way... Sql Server+Php

Hi everybody,

I have installed xampp and used Yii 1.1.14 + MYSQL and everything works fine.

Now I have to move my database to SQL Server 2008 R2 and cannot find driver wich matches my xampp(apache+php)

The question is

Can anyone give me link to any XAMPP(WITH mssql.dll,pdo_mssql.dll, or sqlsrv.dll) version,

or best way to do it without xampp or something

so I can connect to my sql server.

I have installed many XAMPP version, but still cannot connect!!!!!!!


You have asked about this same issue a few times already. The "M" in "XAMPP" is for MySQL, not MS SQL Server. I doubt you will find an XAMPP configured with it, mainly because of the Microsoft license rather than any technical reasons.

The link I provided in the other post for the sqlsrv_pdo drivers should get you the drivers that you need but most likely you’ll have to give up XAMPP and run your app “natively”. Good luck.

From the url I would say you need to use sqlsrv_connect() after uncommenting the following lines in php.ini



Hope this helps?

I already removed semicolon, but it couldn’t find sqlsrv_connect() function, only connected with mssql_connect() function. And still not working

It works!!!!!!!!!!!!!

Thank you everybody,

  1. downloaded php_sqlsrv_53_ts_vc6.dll, php_pdo_sqlsrv_53_ts_vc6.dll files and copy them to C:\xampp\php\ext folder

  2. added to C:\xampp\php\php.ini following lines



  1. Finally connected with following ways

$serverName = ""; //serverName\instanceName

$connectionInfo = array( "Database"=>"PDB", "UID"=>"sa", "PWD"=>"xxx");

$conn = sqlsrv_connect( $serverName, $connectionInfo);

if( $conn ) {/*works*/}

else {/*error*/}

YII code


	'connectionString' => 'sqlsrv:server=;Database=PDB;',			

	'username' => 'sa',

	'password' => 'xxx',

	'charset' => 'utf8',