Skip to content
Advertisement

Ubuntu-16.04 + PHP-7.0.22 + ODBC not working

I have been trying to connect MSSQL from my ubantu 16.04 and i had use below tutorial:

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

There is one problem while i am running below command from terminal is:

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

It display below errors:

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.

I have follow instruction given by below link answer as well: https://serverfault.com/questions/812509/ubuntu-16-04-php-7-microsoft-odbc-driver-for-sql-server-on-linux-odbc-connec

But i am helpless, there is no ODBC driver enabled while i check phpifo in my ubantu-16.04. I am using php7.0.22.

Can anyone guide me to enable ODBC driver in apache as i am stuck ??

Thanks in Advance.

Advertisement

Answer

I have further debug and solved issue by below efforts,

1) I have update PHP from 7.0.22 to 7.0.23 in my Ubuntu 16.04.

2) Remove freetds and currept installation of ODBC from my Ubuntu.

3) Follow all steps mentioned in URL and install again:

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

4) Set values into freetds.conf, odbc.ini, odbcinst.ini

5) Then try command: telnet 192.168.0.1 1433 (your local IP and port)

6) Also try command: 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) And it is successfully connected to MSSQL server and fetch data and display into browser as well.

Thank you.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement