Home > Database > Mysql Tutorial > body text

Linux下使用PHP连接SQL Server 2005

WBOY
Release: 2016-06-07 17:06:55
Original
927 people have browsed it

首先,mssql extension is not available anymore on Windows with PHP 5.3 or later. 当然,php为我们提供了替代方案:windows

首先,mssql extension is not available anymore on Windows with PHP 5.3 or later.

当然,php为我们提供了替代方案:windows下你可以使用微软提供的sqlsrv扩展(官网),而在Linux下则可以使用freetds扩展(官网)。

安装sqlsrv很简单,略过,今天讲讲freetds的安装:

1.下载freetds,,解压,进入源文件目录执行:

重要提示一:这一步需要注意的是--with-tdsver,sql server2005对应的tds version是7.2(貌似网上能查到的都写8.0)

2.重新编译php

重要提示二:至于configure的其它配置我想你懂的,这里只列出mssql的编译选项。


3.配置/usr/local/freetds/etc/freetds.conf(如果没有egServer72节点则创建,如有则修改)

至此,所有准备工作都完成了,下面就可以重启apache,用php调用sql server 2005啦!

重要提示三:在调用mssql_connect函数时,需要注意的是,其第一个参数应该是egServer72(即在freetds.conf里的配置),而不是sql server的IP!!!切记!!!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template