四虎影视在线影院在线观看,小s货再浪些再咬紧点h,国产精品水嫩水嫩,97精产国品一二三产区

  • Board logo

    標(biāo)題: [教程] wdcp連接sqlsever [打印本頁]

    作者: 那誰那誰    時間: 2018-4-4 15:38     標(biāo)題: wdcp連接sqlsever

    1.安裝FreeTDS

    wget ftp://ftp.freetds.org/pub/freetds/stable/freetds-patched.tar.gztar -zxvf freetds-patched.tar.gzll# drwxr-xr-x 10 root  root     4096 Apr  3 17:16 freetds-1.00.84# -rw-r--r--  1 root  root  2913320 Apr  3 17:07 freetds-patched.tar.gzcd freetds-1.00.84[root@iztkatyiq1z1ltz freetds-1.00.84]# lltotal 2284-rw-r--r--  1 11027 11027 137693 Apr  2 17:00 aclocal.m4-rw-r--r--  1 11027 11027   2772 May 19  2016 AUTHORS-rwxr-xr-x  1 11027 11027   1576 May  6  2015 autogen.sh-rw-r--r--  1 11027 11027    309 May 19  2016 BUGS-rw-r--r--  1 11027 11027  23345 Apr  2 17:00 ChangeLog-rw-r--r--  1 11027 11027  14760 Jun  9  2017 CMakeLists.txt-rwxr-xr-x  1 11027 11027   7333 Apr  2 17:00 compile-rwxr-xr-x  1 11027 11027  43940 Apr  2 17:00 config.guess-rw-r--r--  1 root  root  272543 Apr  3 17:15 config.log-rwxr-xr-x  1 11027 11027  18343 May 15  2015 config.rpath-rwxr-xr-x  1 root  root   72697 Apr  3 17:15 config.status-rwxr-xr-x  1 11027 11027  36383 Apr  2 17:00 config.sub-rwxr-xr-x  1 11027 11027 689741 Apr  2 17:00 configure-rw-r--r--  1 11027 11027  30429 Apr  2 17:00 configure.ac-rw-r--r--  1 11027 11027  18092 May 19  2016 COPYING-rw-r--r--  1 11027 11027  25383 May 19  2016 COPYING.LIB-rwxr-xr-x  1 11027 11027  23566 Apr  2 17:00 depcompdrwxr-xr-x  5 root  root    4096 Apr  3 17:16 doc-rw-r--r--  1 11027 11027   1281 Feb  5  2017 freetds.conf-rw-r--r--  1 root  root    4368 Apr  3 17:15 freetds.spec-rw-r--r--  1 11027 11027   4372 May 19  2016 freetds.spec.indrwxr-xr-x  4 root  root    4096 Apr  3 17:15 include-rw-r--r--  1 11027 11027    756 May 19  2016 INSTALL-rwxr-xr-x  1 11027 11027   6760 Apr  2 17:00 install-sh-rw-r--r--  1 11027 11027   2359 May  6  2015 interfaces-rwxr-xr-x  1 root  root  342693 Apr  3 17:15 libtool-rw-r--r--  1 11027 11027    370 May  6  2015 locales.conf-rw-r--r--  1 11027 11027 324089 Apr  2 17:00 ltmain.shdrwxr-xr-x  2 root  root    4096 Apr  3 17:10 m4-rw-r--r--  1 root  root   28983 Apr  3 17:15 Makefile-rw-r--r--  1 11027 11027   2031 May 19  2016 Makefile.am-rw-r--r--  1 11027 11027  29364 Apr  2 17:00 Makefile.indrwxr-xr-x  2 root  root    4096 Apr  3 17:15 misc-rwxr-xr-x  1 11027 11027   6872 Apr  2 17:00 missing-rwxr-xr-x  1 11027 11027    729 Sep 23  2015 mkinstalldirs-rw-r--r--  1 11027 11027  24295 May 19  2016 NEWS-rw-r--r--  1 root  root     762 Apr  3 17:16 PWD-rw-r--r--  1 11027 11027    762 May  6  2015 PWD.in-rw-r--r--  1 11027 11027   3081 May 19  2016 READMEdrwxr-xr-x  2 root  root    4096 Apr  3 17:16 samplesdrwxr-xr-x 10 root  root    4096 Apr  3 17:15 src-rw-r--r--  1 11027 11027    828 May 19  2016 tds.dox-rwxr-xr-x  1 11027 11027   4640 Apr  2 17:00 test-driver-rw-r--r--  1 11027 11027   1048 May 19  2016 Thanks-1.0-rw-r--r--  1 11027 11027   5813 May 19  2016 TODOdrwxr-xr-x  2 root  root    4096 Apr  3 17:15 vmsdrwxr-xr-x  3 root  root    4096 Apr  3 17:15 win32[root@iztkatyiq1z1ltz freetds-1.00.84]# sqlsever2008 with-tdsver 要等于 7.3 ./configure --prefix=/usr/local/freetds --with-tdsver=7.3 --enable-msdblib make && make install配置FreeTDS# cd ../# echo "/usr/local/freetds/lib/" > /etc/ld.so.conf.d/freetds.conf# ldconfig驗證FreeTDS版本這一步非常重要,通過才可以繼續(xù),不然后面的步驟都是無意義的。首先看看版本信息 # /usr/local/freetds/bin/tsql -CCompile-time settings (established with the "configure" script)Version: freetds v1.00.84 freetds.conf directory: /usr/local/freetds/etc MS db-lib source compatibility: yesSybase binary compatibility: no  Thread safety: yes  iconv library: yesTDS version: 7.3  iODBC: no   unixodbc: no  SSPI "trusted" logins: no   Kerberos: noOpenSSL: yes GnuTLS: no   MARS: no測試數(shù)據(jù)庫是否聯(lián)通

    /usr/local/freetds/bin/tsql -H 數(shù)據(jù)庫服務(wù)器IP -p 端口號 -U 用戶名 -P 密碼

    [root@iztkatyiq1z1ltz freetds-1.00.84]# /usr/local/freetds/bin/tsql -H 111.2xx.2xx.2xx -p 56xx -U xxx -P xxx locale is "en_US.UTF-8" locale charset is "UTF-8" using添加PHP擴展pdo的pdo_dblib

    1.確定phpize是否可用

    [root@iztkatyiq1z1ltz freetds-1.00.84]# phpize -vConfiguring forHP Api Version: 20100412Zend Module Api No:  20100525Zend Extension Api No:   220100525

    如果報沒有phpize該命令的話可以嘗試用php的全路徑 如wdcp php 5.6

    /www/wdlinux/phps/56/bin/phpize -v

    2.下載 php5.6包到dblib文件下

    wget hk2.php.net/distributions/php-5.6.35.tar.bz2    tar jxvf php-5.6.35.tar.bz2cd php-5.6.35/ext/pdo_dblib/

    3.執(zhí)行phpize

    /www/wdlinux/phps/56/bin/phpize

    如果報Cannot find config.m4錯誤請看有pdo_dblib沒有config.m4文件。如果沒有cp一份里面帶.m4的文件重命名為config.m4 然后再/www/wdlinux/phps/56/bin/phpize

    ./configure --with-php-config=/www/wdlinux/phps/56/bin/php-config --with-pdo-dblib=/usr/local/freetds/

    /www/wdlinux/phps/56/bin/php-config必須是要修改php.ini所對應(yīng)的php-config

    make && make install

    4.在對應(yīng)的php.ini里面添加配置

    extension = pdo_dblib.so  

    5.重啟php

    6.phpinfo()

    出現(xiàn)pdo_dblib配置就完成配置了

    7.php連接代碼 private function linksever(){ header("content-type:text/html;charset=utf-8");

    try{if(PATH_SEPARATOR==':'){$db = new \PDO("dblib:host=111.xxx.xxx.xxx:56xx;dbname=","usenamexxx","pwdxxx");}else{$db = new \PDO("sqlsrv:Server=111.xxx.xxx.xxx,56xx;Database=xxx","usenamexxx","pwdxxx");}}catch(PDOException $e){echo "ERROR:".$e->getMessage();exit;}//if($db)echo "OK!Connected!<br />";return $db;}




    歡迎光臨 WDlinux官方論壇 (http://cd-genova.com/bbs/) Powered by Discuz! 7.2