php 5.5 + freetds

php 5.5.38
sql server 2008 R2 [protocol: 7.3]
freetds 1.00.62 [support: 7.3 7.4]

apt-get remove freetds-dev  # too old 
wget -c ftp://ftp.freetds.org/pub/freetds/stable/freetds-patched.tar.gz
tar zxfv freetds-patched.tar.gz
cd freetds-*
./configure  --with-tdsver=7.4 --enable-msdblib
make && make install

tsql -C  # check TDS version
TDS version: 7.4

# mssql.so
cd php-5.5.38/ext/mssql/
/app/php/bin/phpize
./configure --with-php-config=/app/php/bin/php-config --with-mssql
make && make install

# pdo_dblib.so
cd ../pdo_dblib/
/app/php/bin/phpize
./configure --with-php-config=/app/php/bin/php-config --with-pdo-dblib
make && make install


# add php.ini
extension = "mssql.so"  
extension ="pdo_dblib.so"  

# php code 
$msdb=mssql_connect("ip:port","user","pass");  

http://www.freetds.org/userguide/choosingtdsprotocol.htm
http://chenxy.blog.51cto.com/729966/1705040

你可能感兴趣的:(php 5.5 + freetds)