Home  >  Article  >  Backend Development  >  Linux PHP连接MSSQL

Linux PHP连接MSSQL

WBOY
WBOYOriginal
2016-06-23 14:32:561103browse

一、软件包

a) freetds-stable.gz

b) php-5.2.12.tar.gz

二、安装步骤

a) tar zxvf freetds-stable.gz

b) cd freetds-0.82/

c) ./configure --prefix=/usr/local/freetds --with-tdsver=8.0

d) Make

e) Make install

f) Tar zxvf php-5.2.12.tar.gz

g) Cd php-5.2.12

h) ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --enable-safe-mode --enable-mbstring --with-mysql=/usr/local/mysql --with-pdo-mysql=/usr/local/mysql/ --with-zlib --with-gd --with-jpeg-dir=/usr --with-png-dir=/usr --without-pear --enable-ftp --enable-zip --enable-sockets --with-mssql=/usr/local/freetds

i) Make

j) Make install

k) Vi /usr/local/php/lib/php.ini

l) extension=php_mssql.dll取掉前面的分号

m) vi /usr/local/freetds/etc/freetds.conf

n) 增加如下代码

[server73]

host = 192.168.0.36

port = 1433

tds version = 8.0

client charset = utf8

o) ./tsql -H192.168.0.36 -p1433 -Usq ?Dgovstock// 测试连接SQLSERVER

p) ./tsql -Sserver73 -Usa ?Dgovstock//测试连接SQLSERVER

q) 输入命令后出现”>”表示连接成功

三、说明

a) 首先要保证SQLSERVER2000/2005可以远程连接。可以telnet ip地址 1433测试1433是否打开。注意防火墙。SQLEXPRESS2005的端口是动态的。不是1433端口。需要先设置成1433静态端口。

Statement:
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
Previous article:PHP 语法 变量Next article:rhel 5下安装php