tar -zxv -f unixODBC-2.3.2.tar.gz
./configure --prefix=/usr/local/unixODBC
make & make install
tar -zxv -f freetds-0.91.112.0.0.tar.gz
./configure --prefix=/usr/local/freetds --with-tdsver=7.1 --enable-msdblib --enable-dbmfix --with-gnu-ld --with-unixodbc=/usr/local/unixODBC
make & make install
vi freetds.conf
[testServer]
host = 192.168.x.x #你的SQL SERVER IP
port = 1433 #SQL SERVER PORT
tds version = 7.0
vi odbc.ini
[testDSN]
Driver = /usr/local/freetds/lib/libtdsodbc.so Description = First Test DSN Trace = No
Servername = testServer # 这个就是FREETDS里面配置的服务器信息
Database = test
UID = test
./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-odbc=unixODBC,/usr/local/unixODBC
make & make install
如果安装了unixODBC-devel后出现如下错误: configure: error: ODBC header file '/usr/local/incl/sqlext.h' not found!
解决方案
mkdir /usr/local/incl/
cp /usr/include/sqlext.h /usr/local/incl/
./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-dblib=/usr/local/freetds
make & make install