I installed unixODBC by using apt-get install, and now when I try to use odbc_connect() is still get this error.
我使用apt-get install安装了unixODBC,现在当我尝试使用odbc_connect()时仍然会出现此错误。
PHP Fatal error: Call to undefined function odbc_connect()
what do i need to do to configure it to work with php? I have been looking online but I can't really figure it out.
我需要做什么来配置它与PHP一起工作?我一直在网上看,但我无法弄明白。
5 个解决方案
#1
2
I think you need to install php5-odbc also. unixODBC provides the driver manager, but you need the PHP code that calls it.
我想你还需要安装php5-odbc。 unixODBC提供驱动程序管理器,但您需要调用它的PHP代码。
#2
2
Had the same issue on CentOS 6.3 with PHP 5.3.16. But the fix was to use yum to install php-odbc.
在使用PHP 5.3.16的CentOS 6.3上遇到了同样的问题。但修复是使用yum来安装php-odbc。
yum install php-odbc
#3
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.
你有没有把它添加到你的LD_LIBRARY_PATH?检查服务器的文档,它可能要求第三方库位于特定的子目录中,或者具有其他一些查找它们的机制。如果是这样,您应该能够创建指向库的符号链接。这样,如果它得到更新,您的服务器将自动使用它。
#4
0
We had this problem also. We installed php5-odbc, and still had the problem. Turns out we needed to reboot Linux for php to see the function. Recycling Apache was not enough!
我们也有这个问题。我们安装了php5-odbc,但仍然遇到了问题。原来我们需要重启Linux for php才能看到这个功能。回收Apache还不够!
#5
0
Make sure to enable odbc
extension for your Apache by a2enmod odbc
.
确保通过a2enmod odbc为您的Apache启用odbc扩展。
Then check if exists by: apache2ctl -M
.
然后检查是否存在:apache2ctl -M。
If you don't have this extension, install via apt-get install php-odbc
(use yum
in case of CentOS).
如果你没有这个扩展,请通过apt-get install php-odbc安装(在CentOS的情况下使用yum)。
See also: Installing the Microsoft ODBC Driver for SQL Server on Linux and macOS.
另请参阅:在Linux和macOS上安装SQL Server的Microsoft ODBC驱动程序。
#1
2
I think you need to install php5-odbc also. unixODBC provides the driver manager, but you need the PHP code that calls it.
我想你还需要安装php5-odbc。 unixODBC提供驱动程序管理器,但您需要调用它的PHP代码。
#2
2
Had the same issue on CentOS 6.3 with PHP 5.3.16. But the fix was to use yum to install php-odbc.
在使用PHP 5.3.16的CentOS 6.3上遇到了同样的问题。但修复是使用yum来安装php-odbc。
yum install php-odbc
#3
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.
你有没有把它添加到你的LD_LIBRARY_PATH?检查服务器的文档,它可能要求第三方库位于特定的子目录中,或者具有其他一些查找它们的机制。如果是这样,您应该能够创建指向库的符号链接。这样,如果它得到更新,您的服务器将自动使用它。
#4
0
We had this problem also. We installed php5-odbc, and still had the problem. Turns out we needed to reboot Linux for php to see the function. Recycling Apache was not enough!
我们也有这个问题。我们安装了php5-odbc,但仍然遇到了问题。原来我们需要重启Linux for php才能看到这个功能。回收Apache还不够!
#5
0
Make sure to enable odbc
extension for your Apache by a2enmod odbc
.
确保通过a2enmod odbc为您的Apache启用odbc扩展。
Then check if exists by: apache2ctl -M
.
然后检查是否存在:apache2ctl -M。
If you don't have this extension, install via apt-get install php-odbc
(use yum
in case of CentOS).
如果你没有这个扩展,请通过apt-get install php-odbc安装(在CentOS的情况下使用yum)。
See also: Installing the Microsoft ODBC Driver for SQL Server on Linux and macOS.
另请参阅:在Linux和macOS上安装SQL Server的Microsoft ODBC驱动程序。