linux+php连接mssql

简介:
因为环境需要,linux+php连接mssql
安装加载freetds模块过程省略网上很多

在/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 ~]# cat /usr/local/freetds/etc/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

       host = 51.102.121.217
       port = 1433
       tds version = 8.0
       client charset = GBK
[root@xafcbackup etc]# cat /data/caijishuju/t.php 
<?php 
$conn=mssql_connect("51.102.121.217","sa", xaj!@34);
      //test
          if($conn)
      {
      echo "ok";
      } else

          {
          echo "no";
          }
?>
程序配置文件连接的是定义的名称而不是ip否则不能连接!
参考http://coralzd.blog.51cto.com/90341/525106


本文转自 liang3391 51CTO博客,原文链接:http://blog.51cto.com/liang3391/664505
相关文章
|
1月前
|
Linux PHP
linux centos7 安装php7.4 实测 遇到的坑
linux centos7 安装php7.4 实测 遇到的坑
52 0
|
21天前
|
Linux 网络安全 数据安全/隐私保护
SSH工具连接远程服务器或者本地Linux系统
SSH工具连接远程服务器或者本地Linux系统
20 0
|
2天前
|
移动开发 监控 网络协议
linux如何查看websocket的连接
linux如何查看websocket的连接
|
2天前
|
Oracle Java 关系型数据库
【服务器】python通过JDBC连接到位于Linux远程服务器上的Oracle数据库
【服务器】python通过JDBC连接到位于Linux远程服务器上的Oracle数据库
14 6
|
3天前
|
Linux 网络安全
xmanager 4 连接SuSE linux server 11方法
xmanager 4 连接SuSE linux server 11方法
|
14天前
|
安全 Linux 网络安全
【专栏】在 Linux 中,端口连接服务和应用,过多开放的端口可能带来安全隐患,教你一招找出所有开放的端口,然后直接干掉!
【4月更文挑战第28天】在 Linux 中,端口连接服务和应用,过多开放的端口可能带来安全隐患。要找出开放端口,可使用 `netstat -anp`、`lsof -i` 或 `nmap` 命令。关闭端口可通过停止相关服务、修改防火墙规则或禁用网络接口。注意不要随意关闭重要端口,操作前备份数据。保持端口安全对系统安全至关重要。
|
17天前
|
监控 Linux 网络安全
Linux服务器如何查询连接服务器的IP
【4月更文挑战第17天】Linux服务器如何查询连接服务器的IP
15 1
|
20天前
|
运维 网络协议 Linux
Linux(28) Linux双网卡配置为连接到Linux主机的PC提供外网访问
Linux(28) Linux双网卡配置为连接到Linux主机的PC提供外网访问
53 1
|
23天前
|
网络协议 安全 Linux
IDEA通过内网穿透实现固定公网地址远程SSH连接本地Linux服务器
IDEA通过内网穿透实现固定公网地址远程SSH连接本地Linux服务器
|
28天前
|
网络协议 关系型数据库 MySQL
Linux Ubuntu系统安装MySQL并实现公网连接本地数据库【内网穿透】
Linux Ubuntu系统安装MySQL并实现公网连接本地数据库【内网穿透】