各位,不行啊 测试时显示Fatal error: Call to undefined function: mssql_connect() in /var/www/html/mssql.php on line 31PHP手册上好象说这个mssql_connect() 只有在windows环境下才可以使用请问bigluckyfox(幸运狐狸),如何安装MSSQL扩展呢?我的Linux 是RH9.0, 安装时完全安装
Requirements for Unix/Linux platforms. To use the MSSQL extension on Unix/Linux, you first need to build and install the FreeTDS library. Source code and installation instructions are available at the FreeTDS home page: http://www.freetds.org/ To get these functions to work, you have to compile PHP with --with-mssql[=DIR], where DIR is the FreeTDS install prefix. And FreeTDS should be compiled using --enable-msdblib. 先安装FreeTDS 后编译php看来你的次序反了
测试时显示Fatal error: Call to undefined function: mssql_connect() in /var/www/html/mssql.php on line 31PHP手册上好象说这个mssql_connect() 只有在windows环境下才可以使用请问bigluckyfox(幸运狐狸),如何安装MSSQL扩展呢?我的Linux 是RH9.0, 安装时完全安装
麻烦举个例子,还不知道怎么用
后编译php看来你的次序反了
到http://www.freetds.org/software.html下载两个安装包
freetds-0.62.1-1.i586.rpm
freetds-unixodbc-0.62.1-1.i586.rpm
然后
#rpm -ivh freetds-0.62.1-1.i586.rpm
#rpm -ivh freetds-unixodbc-0.62.1-1.i586.rpm
很顺利的就安装上了这两个软件,比用源码安装容易多了
然后修改配置文件
(1)
#vi /etc/freetds.conf
去掉其中这几行的注释符,使得成为下面的样子
[MyServer2k]
host = 192.168.0.1
port = 1433
tds version = 8.0
(2)
#vi /etc/odbc.ini
添加下面的内容
[MY_SMARTMAIL] #也可以是其他
Driver = /usr/lib/libtdsodbc.so
Description = ODBC Server
Trace = No
Server = 192.168.0.249
Database = MyDatabase #改成实际存在的数据库
Port = 1433
TDS_Version = 8.0
[Default]
Driver = /usr/lib/libtdsodbc.so(3)
#vi /etc/odbcinst.ini
加入下面的内容
[FreeTDS]
Driver = /usr/lib/libtdsodbc.so然后测试
<?
$handle=odbc_connect("MY_SMARTMAIL", "sa", "");
if($handle){
$resultset=odbc_exec ($handle, "SELECT * FROM t_Item");
odbc_result_all($resultset, "border=1");
odbc_close($handle);
}
?>显示了表的数据但是美中不足的是只能显示英文,中文资料全部显示问号,不支持中文,在我们的应用中,是没有实用价值的要怎样才能支持中文呢?我的PHP用UTF-8编码,一般的SQLServer2k用的是什么编码呢?