PHP FreeTDS连接SQLServer2005

Standard

是不是网上查了这么多文档都没搞定呀… 一堆错误的资料真是害死人呢,最搞的连官方的文档上好像都没说明这个问题.

主要是编译时一定要记得加上 –with-tdsver=8.0 默认是5.0,而官方文档上写得是”IMPORTANT You must build with TDS version 4.2 to access a MSSQL server or Sybase prior to 10.0! “,被这句话害死-_-

freetds安装成功后使用tsql命令连接sqlserver:
/usr/local/lib/freetds/bin/tsql -S 172.0.0.10.1433 -U sa -P 123456

安装步骤:

cd freetds-current
./configure --prefix=/usr/local/lib/freetds --with-tdsver=8.0
make
make install
 
cd php_source/ext/mssql/
phpize
./configure --with-php-config=/usr/local/php/bin/php-config --with-mssql=/usr/local/lib/freetds
make
make install
 
cd php_source/ext/pdo_dblib/
phpize
./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo_dblib=/usr/local/lib/freetds
make
make install

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.