安装unixODBC
wget ftp://ftp.unixodbc.org/pub/unixODBC/unixODBC-2.3.4.tar.gz
tar -zxvf unixODBC-2.3.4.tar.gz
cd unixODBC-2.3.4
./configure
make && make install
安装freetds
wget http://mirrors.ibiblio.org/freetds/stable/freetds-stable.tgz
tar -zxvf freetds-stable.tgz
cd freetds-*
./configure --prefix=/usr/local/freetds --with-tdsver=8.0 --enable-msdblib --with-gnu-ld --with-unixodbc=/usr/local
make && make install
修改tds版本
vim /usr/local/freetds.conf
[global]
tds version = 8.0
参考链接 freetds
进入php安装包目录
cd {path}/php-7.1.5/ext/pdo_dblib/
编译安装
/opt/www/php7.1.5/bin/phpize
./configure --with-php-config=/opt/www/php7.1.5/bin/php-config --with-pdo-dblib=/usr/local/freetds/
make && make install
修改配置,重启
vim /opt/www/php7.1.5/etc/php.ini
extension = pdo_dblib.so
/etc/init.d/php-fpm7.1.5 restart