我来说一下我的错误做法吧:(linux下) 1.下载freetds下本机的tmp下面 2.执行以下命令进行解压 tar zxvf freetds-current.tgz 3.进入freetds-0.64.dev.20050522目录下,执行以下命令配置: ./configure –prefix=/usr/local/freetds --with-tdsver=8.0 --enable-msdblib 4.执行以下命令安装: make make install 5.执行以下命令进行配置php ./configure [--with-apxs... --with-mysql...] ---enable-dbx --with-mssql=/usr/local/freetds make make install 6.再执行以下命令修改freetds: vi /usr/local/freetds/etc/freetds.conf 去掉相关的注释 # A typical Microsoft SQL Server 2000 configuration [MyServer2k] host = 192.168.101.2 (我的IP地址) port = 1433 tds version = 8.0 然后保存我在网上就查到这么些资料,但配置完后再打开网页还提示: Fatal error: Call to undefined function: mssql_connect() in /var/www/html/chkpws.php on line 42
SQL Server 是 Microsoft 从 SyBASE 取得并修改的数据库系统,它只能在 Windows NT Server 上面执行。使用本函数只能使用 Windows NT Server 作为 PHP 的执行平台。这是PHP文档中SQL server相关的一段也就是说,mssql_connect这个函数只能在windows系统下用啦不过新版本的PHP有没有实现Linux下的该函数库,我就不知道啦!如果在windows系统下,下载php_mssql.dll(在www.php.net有下载),放到windows/system32/目录下,然后在程序里加入dl( 'php_mssql.dll' );载入该函数库,或者修改php.ini把;extension=php_mssql.dll前面的分号去掉,然后就可以用mssql_connet()函数了
http://www.php.net/downloads.php下载这个:PHP 4.3.11 zip package [7,289Kb] - 31 Mar 2005 里面有php_mssql.dll
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/ 注: In Windows, the DBLIB from Microsoft is used. Functions that return a column name are based on the dbcolname() function in DBLIB. DBLIB was developed for SQL Server 6.x where the max identifier length is 30. For this reason, the maximum column length is 30 characters. On platforms where FreeTDS is used (Linux), this is not a problem. 安装 The MSSQL extension is enabled by adding extension=php_mssql.dll to php.ini. 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. 这是手册上说的,本人没有实践过。不过看你的帖子,应该已经都做到了。 可能是安装次序有问题,也可能是版本不配套。
1.下载freetds下本机的tmp下面
2.执行以下命令进行解压
tar zxvf freetds-current.tgz
3.进入freetds-0.64.dev.20050522目录下,执行以下命令配置:
./configure –prefix=/usr/local/freetds --with-tdsver=8.0 --enable-msdblib
4.执行以下命令安装:
make
make install
5.执行以下命令进行配置php
./configure [--with-apxs... --with-mysql...] ---enable-dbx --with-mssql=/usr/local/freetds
make
make install
6.再执行以下命令修改freetds:
vi /usr/local/freetds/etc/freetds.conf
去掉相关的注释
# A typical Microsoft SQL Server 2000 configuration
[MyServer2k]
host = 192.168.101.2 (我的IP地址)
port = 1433
tds version = 8.0
然后保存我在网上就查到这么些资料,但配置完后再打开网页还提示:
Fatal error: Call to undefined function: mssql_connect() in /var/www/html/chkpws.php on line 42
odbc的连接方式在windows下的配置一般默认是直接支持的
里面有php_mssql.dll
!
不过具体操作俺就不清楚了:)
The MSSQL extension is enabled by adding extension=php_mssql.dll to php.ini. 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. 这是手册上说的,本人没有实践过。不过看你的帖子,应该已经都做到了。
可能是安装次序有问题,也可能是版本不配套。
想来想去,我感觉就是那句配置php的那句写得不对:
./configure [--with-apxs... --with-mysql...] ---enable-dbx --with-mssql=/usr/local/freetds中间的[]里不是那样做的吧,我一写那句系统就报错,有谁知道[]里面是怎么写的吗?其它地方应该都是对的!
还请各位大哥帮忙了!
我句连接误也出错,用户名,密码,服务器名都对,请问有人知道吗?