zoukankan      html  css  js  c++  java
  • linux php5.6 链接sql server

    先确定2个,sql server版本,我是sql server2008

    最终是freetds-1.00.20.tar.gz+ TDS version: 7.3

         Version: freetds v1.00.20
                 freetds.conf directory: /usr/local/freetds/etc
         MS db-lib source compatibility: yes
            Sybase binary compatibility: no
                          Thread safety: yes
                          iconv library: yes
                            TDS version: 7.3
                                  iODBC: no
                               unixodbc: yes
                  SSPI "trusted" logins: no
                               Kerberos: no
                                OpenSSL: yes
                                 GnuTLS: no
                                   MARS: no
    

      

    # 关于freetds编译时with-tdsver参数
    # 参考:https://www.freetds.org/userguide/choosingtdsprotocol.htm
    # 在FreeTDS 1.1版本之后,可以设置为auto,版本之前需要手动指定。
    以前写过mssql模块安装,这次只是补充编译freetds时指定with-tdsver参数
    1、下载freetds及php源码包

    1
    2
    [root@VM_0_11_centos ~]# wget -c ftp://ftp.freetds.org/pub/freetds/stable/freetds-1.00.20.tar.gz
    [root@VM_0_11_centos ~]# wget -c http://museum.php.net/php5/php-5.2.17.tar.gz

    2、安装freetds
    # 解压freetds源码包

    1
    2
    [root@VM_0_11_centos ~]# tar zxvf freetds-1.1.21.tar.gz
    [root@VM_0_11_centos ~]# cd freetds-1.1.21/

    # 开始编译安装

    1
    2
    [root@VM_0_11_centos ~]# ./configure --prefix=/usr/local/freetds --with-tdsver=7.3 --enable-msdblib
    [root@VM_0_11_centos ~]# make && make install

    如果之前tsql有老版本,记得ls -n重新软连接一下

    ln -s /usr/local/freetds/bin/tsql /usr/bin

    tsql -C输出

      Version: freetds v1.00.20
                 freetds.conf directory: /usr/local/freetds/etc
         MS db-lib source compatibility: yes
            Sybase binary compatibility: no
                          Thread safety: yes
                          iconv library: yes
                            TDS version: 7.3
                                  iODBC: no
                               unixodbc: yes
                  SSPI "trusted" logins: no
                               Kerberos: no
                                OpenSSL: yes
                                 GnuTLS: no

    3、编译mssql模块
    # 解压php源码包

    1
    [root@VM_0_11_centos ~]# tar zxvf php-5.6.30.tar.gz

    # 进入mssql扩展目录

    1
    [root@VM_0_11_centos ~]# cd php-5.6.30/ext/mssql/

    # 生成configure

    1
    [root@VM_0_11_centos mssql]# /www/server/php/52/bin/phpize

    # 开始编译

    1
    2
    [root@VM_0_11_centos php-5.6.30]# ./configure  --with-php-config=/www/server/php/56/bin/php-config --with-mssql=/usr/local/freetds
    [root@VM_0_11_centos php-5.6.30]# make && make install

    4、编辑php.ini文件,加入mssql扩展,在 491 行下面添加(如果不会用vi编辑器,可直接将文件下载改完再传上去)

    1
    2
    3
    [root@VM_0_11_centos ~]# vi /www/server/php/52/etc/php.ini
    extension_dir = "/www/server/php/52/lib/php/extensions/no-debug-non-zts-20060613/"
    extension = mssql.so # 新增行

    保存退出,重启php或者重启服务器。

  • 相关阅读:
    HTML5-拖拽
    POJ1182食物链(并查集)
    欧拉函数之HDU1286找新朋友
    Another kind of Fibonacce(矩阵快速幂,HDU3306)
    我的第一道java_A+B
    bestcoder#33 1002 快速幂取余+模拟乘,组合数学
    快速幂模版
    bestcoder#33 1001 高精度模拟
    poj2446_二分图
    poj3984_bfs+回溯路径
  • 原文地址:https://www.cnblogs.com/showker/p/13427158.html
Copyright © 2011-2022 走看看