1. Download: freetds-patched.tar.gz http://www.freetds.org/software.html
Http://www.freetds.org/userguide/choosingtdsprotocol.htm
# TAR-ZXVF Freetds-patched.tar.gz
# CD freetds-1.00.21
Note that this is the--with-tdsver=7.4, this is very important, you need to choose the correct configuration according to your database version, because now mostly SQLserve2008 so need to choose 7.3; This example is connection sqlserver2012, all need to select 7.4.
In fact, refer to the official website of the document to know the problem, but because many people download the old version FreeTDS-0.91, even if set to--with-tdsver=7.4 or above is not used.
#./configure--prefix=/usr/local/freetds--with-tdsver=7.4--enable-msdblib
# Make && make install
2. verifying the FreeTDS version
This step is very important, it can be continued, or the subsequent steps are meaningless.
first look at the version information
Test Database Connectivity
#/usr/local/freetds/bin/tsql-h Database Server ip-p port number-u user name-p password
/usr/local/freetds/bin/tsql-h 106.14.24.155-p 1433-u sa-p hell[email protected]
3. Increase the pdo_dblib of the PHP extension PDO
#cd/USR/LOCAL/SRC/ONEINSTACK/SRC
#tar ZXVF php-5.6.28.tar.gz
#cd php-5.6.28
#cd/ext/pdo_dblib
Using Phpize to add extensions to PHP dynamically under Linux
#/usr/local/php/bin/phpize
#./configure--with-php-config=/usr/local/php/bin/php-config--with-pdo-dblib=/usr/local/freetds/
# Make && make install
Added in php.ini file :extension= "pdo_dblib.so"
4. increase the MSSQL extension
#cd/usr/local/src/oneinstack/src/php-5.6.28/ext/mssql
Using Phpize to add extensions to PHP dynamically under Linux
#/usr/local/php/bin/phpize
#./configure--with-php-config=/usr/local/php/bin/php-config--with-mssql=/usr/local/freetds/
# Make && make install
Added in php.ini file: extension= "mssql.so"
5. Restart Php-fpm,nginx
#service php-fpm Restart.
#service nginx Restart
6. Visit Phpinfo to see if the pdo_dblib extension is installed
Linux uses FreeTDS to connect remote servers sqlservser2012