centos php5.6 安装sqlserver扩展

centos php5.6 安装sqlserver扩展
1、安装freetds
wget http://ibiblio.org/pub/Linux/ALPHA/freetds/stable/freetds-stable.tgz
tar zxvf freetds-stable.tgz
cd freetds-0.91/
./configure –prefix=/usr/local/freetds0.91 –enable-msdblib –with-tdsver=8.0
make &&make install

2、修改配置文件,增加库连接信息
vi /usr/local/freetds0.91/etc/freetds.conf
host = mssql.yourdomain.com
port = 1433
tds version = 8.0
client charset = UTF-8

3、编译php时加上
–with-mssql=/usr/local/freetds0.91
或者以扩展编译php,略

至此mssql_connect应该是可以工作了,如果想要通过pdo连接mssql,还要编译pdo的mssql扩展
cd /php源码目录/ext/mssql
/usr/local/php/bin/phpize
./configure –with-php-config=/usr/local/php/bin/php-config –with-pdo-dblib=/usr/local/freetds
make && make install

发表评论