步骤:
第一步:编译并安装freetds:
cd /tmp/
tar xzf freetds-*.tgz
cd freetds-*/
./configure --prefix=/usr/local/freetds
gmake
gmake install
第二步:编译并安装php4
./configure --with-mysql --with-sybase=/usr/local/freetds ....(后面的参数根据各自的需要不一而同)
#例子(我的编译参数): ./configure --prefix=/usr/local/php --with-mysql --with-apxs2=/usr/local/apache/bin/apxs --with-zlib --with-jpeg-dir=/usr --with-png --with-freetype --with-ttf --enable-gd-native-ttf --with-gd --enable-sockets --enable-dio --with-sybase=/usr/local/freetds --with-dom
make
make install
第三步:配置freetds
vim /usr/local/freetds/etc/freetds.conf
具体配置见该文件中的说明
例:
[myserver2k]
host = 192.168.0.1
port = 1433
tds version = 8.0
并且可以把不用的jdbc区间注释掉
第四步:配置php.ini文件
修改相关的mssql区间配置,默认可以不用修改
第五步:测试
mssql_connect("192.168.0.1:1433","sa","");
mssql_select_db('testdb');
$sql = "select * from test_table where condition = '条件';";
$result = mssql_query($sql);
$row = mssql_fetch_array($result);
print_r($row);
?>
不出意外的话,你将看到你期望的结果.
以上步骤在: redhat 9.0, apache 2.0.52, php 4.3.11 环境下通过.
Java Asp PHP .Net XML C/C++ CGI VB Jsp J2ee J2se J2me EJB Servlet Tomcat Resin Struts Weblogic Eclipse ANT GUI JMS Web servise IDEA Webphere Hibernate Spring Jboss Applet Swing Socket Javamail Perl Ajax P2P 安全 模式 框架 测试 开源 游戏
Windows XP Windows 2000 Windows 2003 Windows Me Windows 9.x Linux UNIX 注册表 操作系统 服务器 应用服务器