步骤: 第一步:编译并安装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 环境下通过.
|
|