gpt4 book ai didi

php - Ubuntu-16.04 + PHP-7.0.22 + ODBC 不工作

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:38:13 25 4
gpt4 key购买 nike

我一直在尝试从我的 ubantu 16.04 连接 MSSQL,我使用了以下教程:

https://askubuntu.com/questions/578934/mssql-connection-from-ubuntu

当我在终端下运行命令时出现一个问题是:

sudo apt install php7.0-odbc php7.0-sybase tdsodbc

它显示以下错误:

The following packages have unmet dependencies:
php7.0-odbc : Depends: php7.0-common (= 7.0.4-7ubuntu2) but 7.0.22-0ubuntu0.16.04.1 is to be installed
php7.0-sybase : Depends: php7.0-common (= 7.0.4-7ubuntu2) but 7.0.22-0ubuntu0.16.04.1 is to be installed
E: Unable to correct problems, you have held broken packages.

我也遵循以下链接答案给出的说明: https://serverfault.com/questions/812509/ubuntu-16-04-php-7-microsoft-odbc-driver-for-sql-server-on-linux-odbc-connec

但我很无奈,当我在我的 ubantu-16.04 中检查 phpifo 时,没有启用 ODBC 驱动程序。我正在使用 php7.0.22。

谁能指导我在 apache 中启用 ODBC 驱动程序,因为我被卡住了??

提前致谢。

最佳答案

我通过以下努力进一步调试并解决了问题,

1) 我在我的 Ubuntu 16.04 中将 PHP 从 7.0.22 更新到 7.0.23。

2) 从我的 Ubuntu 中删除 freetds 和当前安装的 ODBC。

3) 按照 URL 中提到的所有步骤重新安装:

https://askubuntu.com/questions/578934/mssql-connection-from-ubuntu

4) 设置值到freetds.conf, odbc.ini, odbcinst.ini

5)然后尝试命令:telnet 192.168.0.1 1433(你的本地IP和端口)

6) 也试试命令:tsql -S 'DNS name' -U devuser/isql -v DNS Name User 'Password'

(In my case in tsql and isql IP was not working and DNS name working and connect to  SQL server so check alternate for connection)

7) 成功连接到MSSQL服务器并获取数据并显示到浏览器中。

谢谢。

关于php - Ubuntu-16.04 + PHP-7.0.22 + ODBC 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46040497/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com