linux下php 加装mssql模块

来源:晓辉 责任编辑:栏目编辑 发表时间:2013-07-01 14:13 点击:

作者:coralzd 网址:http://www.freebsdsystem.org/php_mssql
 

在linux 下的php连接mssql,就需要安装第三方的freetds了。
1、安装配置freetds
 

  1. wget http://mirrors.xmu.edu.cn/ubuntu/archive/pool/main/f/freetds/freetds_0.82.orig.tar.gz  
  2. tar zxf freetds_0.82.orig.tar.gz  
  3. cd freetds_0.82 
  4. ./configure --prefix=/usr/local/freetds --with-tdsver=8.0 -–enable-msdblib -–enable-dbmfix -–with-gnu-ld -–enable-shared -–enable-static  
  5. make && make install  

2、编译php的mssql模块
 

  1. cd /path/to/php/source 进入PHP源码目录  
  2. cd ext/mssql 进入MSSQL模块源码目录  
  3. /usr/local/webserver/php/bin/phpize 生成编译配置文件  
  4. ./configure –with-php-config=/usr/local/webserver/php/bin/php-config –with-mssql=/usr/local/freetds  
  5. make  
  6. make install  
  7. 编译完成生成 mssql.so,修改php.ini,将该模块载入:  
  8. extension=”/path/to/extension/mssql.so”  
  9.  

3、配置mssql
cd /usr/local/freetds/etc
编辑文件:
vi freetds.conf

 

  1. [global]  
  2. # TDS protocol version  
  3. ; tds version = 4.2  
  4.  
  5. # Whether to write a TDSDUMP file for diagnostic purposes  
  6. # (setting this to /tmp is insecure on a multi-user system)  
  7. ; dump file = /tmp/freetds.log  
  8. ; debug flags = 0xffff  
  9.  
  10. # Command and connection timeouts  
  11. ; timeout = 10  
  12. ; connect timeout = 10  
  13.  
  14. # If you get out-of-memory errors, it may mean that your client  
  15. # is trying to allocate a huge buffer for a TEXT field.  
  16. # Try setting ‘text size’ to a more reasonable limit  
  17. text size = 64512  
  18. client charset = UTF-8 #加入  
  19.  
  20. #加入  
  21. [Server2005]  
  22. host = 192.168.x.x  
  23. port = 1433  
  24. tds version = 7.2  
  25.  

4、测试php连接mssql

 

  1. <

    相关新闻>>

      发表评论
      请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
      用户名: 验证码:点击我更换图片
      最新评论 更多>>

      推荐热点

      • sql常见面试题
      • SQL SERVER 2005性能之跟踪
      • SQL编程(一)
      • LINUX上RMAN自动备份脚本
      • sql server面试题
      • 如何将多个SQL查询统计结果一次显示出来
      • 浅谈SQL Server中的事务日志(三)----在简单恢复模式下日志的角色
      • sql server 列转行
      • SQL小技巧系列 --- 行转列合并
      网站首页 - 友情链接 - 网站地图 - TAG标签 - RSS订阅 - 内容搜索
      Copyright © 2008-2015 计算机技术学习交流网. 版权所有

      豫ICP备11007008号-1