Yii2 SQL Server 2008 connection

Source: Internet
Author: User
Tags dsn fpm

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.