linux php 链接sql server

首先需要下载freetds这个软件 它可以用来连接sqlserver和 Sybase
#wget   ftp://ftp.ibiblio.org/pub/Linux/ALPHA/freetds/stable/freetds-stable.tgz
编译安装
#tar  xvf   freetds-stable.tgz
#cd freetds-0.91/
#./configure –prefix=/usr/local/freetds --with-tdsver=4.2  --enable-msdblib
--with-tdsver是指安装tds7.2版本 详细参照官方说明
http://www.freetds.org/userguide/choosingtdsprotocol.htm
#make && make install
# echo "/usr/local/freetds/lib/"  > /etc/ld.so.conf.d/freetds.conf
#ln -s /usr/local/freetds/lib/libsybdb.so.5.0.0  /usr/local/freetds/lib/libsybdb.so.4
#/sbin/ldconfig
#vim /usr/local/freetds/etc/freetds.conf 
  [global]
        # TDS protocol version
;       tds version = 4.2

        # Whether to write a TDSDUMP file for diagnostic purposes
        # (setting this to /tmp is insecure on a multi-user system)
;       dump file = /tmp/freetds.log
;       debug flags = 0xffff

        # Command and connection timeouts
;       timeout = 10
;       connect timeout = 10

        # If you get out-of-memory errors, it may mean that your client
        # is trying to allocate a huge buffer for a TEXT field.
        # Try setting 'text size' to a more reasonable limit
        text size = 64512

        host = mssql.yourdomain.com
        port = 1433
        tds version = 8.0
        client charset = UTF-8
#cd php-5.2.17/ext/mssql
#/usr/local/php/bin/phpize
#./configure --with-php-config=/usr/local/php/bin/php-config --with-mssql=/usr/local/freetds/
#make  && make install
#vim /usr/loca/php/etc/php.ini
extension = "mssql.so"

你可能感兴趣的:(sql,linux,PHP,链接)