linux+php连接mssql

来源:网络 责任编辑:栏目编辑 发表时间:2013-07-01 03:13 点击:

因为环境需要,linux+php连接mssql
安装加载freetds模块过程省略网上很多
 
yum install unixODBC*
在/etc/profile
中加入export PATH="$PATH:/usr/local/freetds/bin"
#echo "/usr/local/freetds/lib" >> /etc/ld.so.conf
source /etc/profile
#ldconfig
 
再配置freetds
/usr/local/freetds/etc
[root@xafcbackup etc]# cat freetds.conf
#   $Id: freetds.conf,v 1.12 2007/12/25 06:02:36 jklowden Exp $
#
# This file is installed by FreeTDS if no file by the same
# name is found in the installation directory. 
#
# For information about the layout of this file and its settings,
# see the freetds.conf manpage "man freetds.conf".
# Global settings are overridden by those in a database
# server specific section
[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
# A typical Sybase server
# A typical Microsoft server
[egServer70]
        host = 51.102.111.123
        port = 1433
        tds version = 8.0
 
[root@xafcbackup etc]# cat /data/caijishuju/t.php
<?php
$conn=mssql_connect("egServer70","sa",xaj!@34);
       //test
           if($conn)
       {
       echo "ok";
       } else
          
           {
           echo "no";
           }
?>
 
程序配置文件连接的是定义的名称而不是ip否则不能连接!
作者 “linux”

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

    推荐热点

    • /etc/fstab 详解
    • nginx主主集群
    •  LVS-NAT和LVS-DR模式的实现详解
    •  RHCE考试之磁盘配额
    • 学习笔记:ACL详解
    •  LVM逻辑卷管理器
    • suse linux双网卡双网关配置
    •  Nginx主主负载均衡架构
    • ubuntu学习Mysql

    快速直达

    操作系统导航

    LinuxWindows虚拟机
    网站首页 - 友情链接 - 网站地图 - TAG标签 - RSS订阅 - 内容搜索
    Copyright © 2008-2015 计算机技术学习交流网. 版权所有

    豫ICP备11007008号-1