简体   繁体   English

PHP Wordpress odbc_connect():“错误:调用未定义的 function odbc_connect()”

[英]PHP Wordpress odbc_connect() : "Error: Call to undefined function odbc_connect()"

I have a custom plugin in Wordpress 6.0.2 , programmed with PHP 8.1 .我在Wordpress 6.0.2中有一个自定义插件,用PHP 8.1编程。

When I run the function:当我运行 function 时:

$conn = odbc_connect($DNS, "", "");

Returns the following error:返回以下错误:

Error: Call to undefined function odbc_connect()错误:调用未定义的 function odbc_connect()

The server where the website (and the plugin) is hosted has the Linux Ubuntu 18.04 operating system.托管网站(和插件)的服务器具有 Linux Ubuntu 18.04操作系统。

I have installed all the necessary dependencies and libraries (and more), but it keeps showing the same error all the time:我已经安装了所有必要的依赖项和库(以及更多),但它一直显示相同的错误:

sudo apt-get install libc6 libstdc++6 zlib1g libgcc1

sudo apt-get install unixODBC unixODBC-dev

sudo apt-get install php-odbc or sudo apt-get install php8.1-odbc sudo apt-get install php-odbcsudo apt-get install php8.1-odbc

Everything is installed correctly, the driver too (and it is also configured correctly):一切都已正确安装,驱动程序也已正确安装(并且也已正确配置):

Configuration配置

The code is correct, it works locally.代码是正确的,它在本地工作。 And the error has nothing to do with the Driver or the connection parameters.并且该错误与驱动程序或连接参数无关。 It has to do with it not detecting the "odbc_connect()" function.它与未检测到“odbc_connect()” function 有关。

What can be the solution?有什么解决办法? Does anyone have any idea what might be missing?有谁知道可能缺少什么?

Thanks.谢谢。

I think the problem here is that you're using odbc_connect.我认为这里的问题是您使用的是 odbc_connect。 Try odbc_pconnect, maybe it's better for servers.试试 odbc_pconnect,也许它对服务器更好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM