Mssql Driver And Yii

HI I have ubuntu12.10 and I am trying to connect to mssql server database with yii but whenever I try to go to gii in order to create the crud the following error occured

I have checked yii requirement and found that the PDO MSSQL extension (pdo_dblib) is installed and passed as you can see below.

also I have tried to to connect to the mssql server using


and it is working fine.

here you are the db array from my main.config

        'db' => array(            

        'connectionString' => 'mssql:host=myip;port=1433;dbname=test',

            'emulatePrepare' => true,

            'username' => 'myuser',

            'password' => 'mypassword',

            'charset' => 'utf8',


can any body advice what is the problem and how to solve it thanks,

See here.

Your connection string is incorrect, the mssql driver is no longer in PDO.


I’ve dug up my own notes on getting this to work. Here’s what it says:

sudo apt-get install php5-sybase

Add the following to the end of /etc/freetds/freetds.conf



	port = 1433

	tds version = 7.0

sudo service apache2 restart

Then configure your connection string as:


You only need the tds version = 7.0 if you’re using the same ancient version of SQL Server as we are. Try without that line first.

The HOSTNAMEHERE can be anything you like as far as I know, it just tells the system which freetds config entry to use.

Thank you Keith, the problem was as you said in the connection string

I have replaced the [color=#008800][size=2]mssql:host [/size][/color][size=2]with [color="#2e8b57"]dblib:host [/color]in the connection string and that’s solved the problem.[/size]

[size=2]thanks again,[/size]