无标题文档
wdCP系统 (介绍,功能特性,运行环境,安装说明,演示,常见问题,使用教程) wdCDN系统 (介绍,功能特性,运行环境,安装说明,演示,常见问题,使用手册)
wdOS系统 (介绍,功能特性,运行环境,安装说明,演示,常见问题,使用教程) wdDNS系统 (介绍,功能特性,运行环境,安装说明,演示,常见问题,使用手册)
注册 发贴 提问 回复-必看必看 wddns免费智能 DNS 开通 本地或虚拟机使 用wdcp 一键包在mysql编 译时"卡住"
【300G高防】双线 无视攻击 wdcp官方技术支持/服务 阿里云8折优惠券 无敌云 腾讯云优惠中,现注册更有260代金额券赠送
返回列表 发帖
提问三步曲: 提问先看教程/FAQ索引(wdcp,wdcp_v3,一键包)及搜索,会让你更快解决问题
1 提供详细,如系统版本,wdcp版本,软件版本等及错误的详细信息,贴上论坛或截图发论坛
2 做过哪些操作或改动设置等

温馨提示:信息不详,很可能会没人理你!论坛有教程说明的,也可能没人理!因为,你懂的

[教程] 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版本这一步非常重要,通过才可以继续,不然后面的步骤都是无意义的。首先看看版本信息 # /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测试数据库是否联通

/usr/local/freetds/bin/tsql -H 数据库服务器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.执行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所对应的php-config

make && make install

4.在对应的php.ini里面添加配置

extension = pdo_dblib.so  

5.重启php

6.phpinfo()

出现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;}

返回列表