Reference articles
Http://www.cnblogs.com/facetwitter/p/6444706.html?utm_source=itdadao&utm_medium=referral
Http://www.cnblogs.com/jiechn/p/4841865.html
1. FreeTDS must be installed
Configuration
[Myconfig]
Host = 192.168.2.22
Port = 1433
TDS Version = 8.0
Client Chaeset = UTF-8
Test:/usr/local/freetds/bin/tsql-h Database Server ip-p port number-u user name-p password (I am not connected with this test)
This is what I tested: CDs to/USR/LOCAL/FREETDS/BIN/TSQL
Tsql-s myconfig -u name-p password can be connected, simple command use database;top * from table;
3 Next add php mssq and pdo_dblib extensions
My environment is nginx, so restart the nginx restart PHP-FPM
4. Last Database Configuration
' Class ' = ' yii\db\connection ',
' DSN ' = ' dblib:host=myconfig;dbname=dbname ',//Here I use IP he can't, with this name can, I do not know, this if not, try the following
' DSN ' = ' sqlsrv:server=myconfig;database=dbname ',
' Username ' = ',
' Password ' = ',
' CharSet ' = ' utf8 ',
' Persistent ' = false,
' Enableschemacache ' = true,
Duration of the schema cache.
' Schemacacheduration ' = 300,
The Name of the cache component used. Default is ' cache '.
' SchemaCache ' = ' cache ',
If the report can not find the driver, first ensure that the above extensions and modules, restart NGINX,PHP-FPM, and then the DSN configuration problem
Yii2 SQL Server 2008 connection