I mainly refer to the official articles
Some points to be aware of
1, compile FreeTDS (need to download), please add--prefix= installation directory--with-tdsver=7.1//This must be over 7.0 from official documents
./configure--prefix=/opt/freetds--with-tdsver=7.1
2, in addition to PHP connection time also need to add pdo_dblib (besides this there are 2 other ways)
3, compile pdo_dblib must specify the FreeTDS installation directory, otherwise you will not be connected to the parameters as follows
./configure--with-php-config=/usr/local/php/bin/php-config--with-pdo-dblib=/opt/freetds
4. After installation, test with TSQL to view the FreeTDS version for command
[[email protected] pdo_dblib]# tsql -ccompile-time settings (established with the "Configure" script) version: freetds v0.91 Freetds.conf directory: /opt/freetds/etc ms db-lib source compatibility: no Sybase binary compatibility: no Thread safety: yes iconv library: yes TDS version: 7.1 iodbc: no unixodbc: no SSPI "Trusted" logins: no kerberos: no
5. The test command is as follows:
[Email protected] pdo_dblib]# tsql-h 10.1.1.200-p 1433-u sapassword:locale is "en_US. UTF-8 "Locale charset is" UTF-8 "using default CharSet" UTF-8 "
6. Tips for adding ln-s shortcuts so you can use the TSQL command.
Ln-s/opt/freetds/bin/tsql/usr/bin/tsql
7. PDO Connection MSSQL mode
$DBH = new PDO ("dblib:host= $hostdb;d bname= $dbname", $USR, $PSW);
PDO connect MSSQL 3 ways as follows (only available under Linux under Windows Please see my previous post on SQL Server)
http://php.net/manual/zh/ref.pdo-dblib.connection.php
Using FreeTDS connection under Linux sqlserver2008