Sqlsrv Connection Fails To Open

I’m running yii on my local machine on WAMP. I also have a database which is installed with MS SQL Server 2008 R2

Normally I run yii with a mysql database but now I’m trying to set up yii on MS SQL server

config =


‘connectionString’ => ‘sqlsrv:server=localhost;database=NEIL’,

// ‘emulatePrepare’ => true,

‘username’ => ‘xxxxx’,

‘password’ => ‘xxxx’,

When I run ?=gii to create model, controller and CRUD code I’m getting the following error message at this code:

public function init()

56 {

57 if(Yii::app()->{$this->connectionId}===null)

58 throw new CHttpException(500,‘A valid database connection is required to run this generator.’);

59 $this->tablePrefix=Yii::app()->{$this->connectionId}->tablePrefix;

60 parent::init();

61 }

This is the error message:

CDbConnection failed to open the DB connection: 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…/?LinkId=163712

I have downloaded an installed these sqlsrv drivers.


This is what my phpinfo says:


pdo_sqlsrv support enabled

Directive Local Value Master Value

pdo_sqlsrv.client_buffer_max_kb_size 10240 10240

pdo_sqlsrv.log_severity 0 0

	I have also installed the Microsoft ODBC Driver 11 for SQL Server.

	However I didn't configure this ODBC driver in any way. I only installed.

	Do I need to do some configuration of the driver?


	Thank you in advance for your help.



I have now onnfigured and tested the ODBC driver.

However, I am still getting the same error.


I solved the problem. I now have a connection to the SQL Server Database.

I used this link as a guide http://vimalakanchanamsc.wordpress.com/2011/12/09/microsoft-sql-server-2-0-drivers-for-php-using-sqlsrv/

installed these extensions



this is PHPinfo


sqlsrv support enabled

Directive Local Value Master Value

sqlsrv.LogSeverity 0 0

sqlsrv.LogSubsystems 0 0

sqlsrv.WarningsReturnAsErrors On On

‘connectionString’ => ‘sqlsrv:server=servername ; Database=databasename’,