<dl id='nrx48'></dl>

        <acronym id='nrx48'><em id='nrx48'></em><td id='nrx48'><div id='nrx48'></div></td></acronym><address id='nrx48'><big id='nrx48'><big id='nrx48'></big><legend id='nrx48'></legend></big></address>

      1. <tr id='nrx48'><strong id='nrx48'></strong><small id='nrx48'></small><button id='nrx48'></button><li id='nrx48'><noscript id='nrx48'><big id='nrx48'></big><dt id='nrx48'></dt></noscript></li></tr><ol id='nrx48'><table id='nrx48'><blockquote id='nrx48'><tbody id='nrx48'></tbody></blockquote></table></ol><u id='nrx48'></u><kbd id='nrx48'><kbd id='nrx48'></kbd></kbd>
      2. <ins id='nrx48'></ins>

          <span id='nrx48'></span>

          <code id='nrx48'><strong id='nrx48'></strong></code>

        1. <fieldset id='nrx48'></fieldset>
        2. <i id='nrx48'></i>
          <i id='nrx48'><div id='nrx48'><ins id='nrx48'></ins></div></i>

          linux下php加装mssql模块的方法

          • 时间:
          • 浏览:10
          • 来源:124软件资讯网
            1、安装设置freetds
            . 代码如下:
            wget http://mirrors.xmu.edu.cn/ubuntu/archive/pool/main/f/freetds/freetds_0.82.orig.tar.gz
            tar zxf freetds_0.82.orig.tar.gz
            cd freetds_0.82
            ./configure --prefix=/usr/local/freetds --with-tdsver=8.0 -–enable-msdblib -–enable-dbmfix -–with-gnu-ld -–enable-shared -–enable-static
            make && make install

            2、编译php的mssql模块
            . 代码如下:
            cd /path/to/php/source 进入PHP源码目录
            cd ext/mssql 进入MSSQL模块源码目录
            /usr/local/webserver/php/bin/phpize 天生编译设置文件
            ./configure –with-php-config=/usr/local/webserver/php/bin/php-config –with-mssql=/usr/local/freetds
            make
            make install
            编译完成天生 mssql.so  ,修改php.ini ,将该模块载入:
            extension=”/path/to/extension/mssql.so”

            3、设置mssql
            . 代码如下:
            cd /usr/local/freetds/etc
            编辑文件:
            vi 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
            client charset = UTF-8 #加入
            #加入
            [Server2005]
            host = 192.168.x.x
            port = 1433
            tds version = 7.2

            4、测试php毗连mssql
            . 代码如下:
            try {
            $hostname='218.x.x.x';//注重,这里和上面差别,要直接用IP地址或主机名
            $port=1433;//端口
            $dbname="user";//库名
            $username="database";//用户
            $pw="passwd";//密码
            $dbh= new PDO("dblib:host=$hostname:$port;dbname=$dbname","$username","$pw");
            } catch (PDOException $e) {
            echo"Failed to get DB handle: ".$e->getMessage() ."n";
            exit;
            }
            echo'connent MSSQL succeed';
            $stmt=$dbh->prepare("select * from z_2010pinjiu_user");
            $stmt->execute();
            while ($row=$stmt->fetch()) {
            print_r($row);
            }
            unset($dbh); unset($stmt);
            ?>