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

Ubuntu-16.04 + PHP-7.0.22 + ODBC not working

我一直在尝试从我的 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.

我也遵循以下 link 答案给出的说明: 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.

中删除 ODBC 的 freetds 和当前安装

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服务器并获取数据并显示到浏览器中。

谢谢。