2

我使用 apt-get install 安装了 unixODBC,现在当我尝试使用 odbc_connect() 时仍然出现此错误。

PHP Fatal error:  Call to undefined function odbc_connect()

我需要做些什么来配置它以使用 php?我一直在网上寻找,但我无法弄清楚。

4

5 回答 5

2

我认为您还需要安装 php5-odbc。unixODBC 提供驱动程序管理器,但您需要调用它的 PHP 代码。

于 2011-08-18T09:29:47.460 回答
2

在 CentOS 6.3 和 PHP 5.3.16 上也有同样的问题。但解决方法是使用 yum 安装 php-odbc。

yum install php-odbc
于 2012-08-23T20:17:24.650 回答
0

Did you add it to your LD_LIBRARY_PATH? Check the documentation for your server, it may require third-party libraries to be in a specific sub-directory, or have some other mechanism for finding them. If so, you should be able to create a symbolic link to the library. That way, if it gets updated, your server will automatically use it.

于 2011-08-05T16:32:43.790 回答
0

我们也有这个问题。我们安装了 php5-odbc,但仍然有问题。事实证明,我们需要重新启动 Linux 才能让 php 看到该功能。回收 Apache 还不够!

于 2014-04-04T18:54:05.177 回答
0

确保通过odbc为您的 Apache 启用扩展a2enmod odbc

然后通过以下方式检查是否存在:apache2ctl -M

如果您没有此扩展程序,请通过安装apt-get install php-odbcyum在 CentOS 的情况下使用)。

另请参阅:在 Linux 和 macOS 上安装 Microsoft ODBC Driver for SQL Server

于 2017-10-24T17:15:49.440 回答