PHP7 - MSSQL ODBC on FreeBSD

General discussion on PHP
Post Reply
jaso9146
Posts: 29
Joined: Mon Jan 12, 2015 8:58 pm

PHP7 - MSSQL ODBC on FreeBSD

Post by jaso9146 » Thu Nov 05, 2015 3:20 am

Per the PHP7 migration guide, the mssql module has been removed.
http://php.net/manual/en/migration70.re ... -sapis.php

All the documentation that I have found says to use ODBC (or PDO_ODBC) but that requires unixODBC, which relies on a FreeTDS ODBC driver (libtdsodbc.so) that is no longer part of FreeTDS. I can find RHEL5/6 drivers from Microsoft and other third parties but nothing for FreeBSD.

Does this mean that FreeBSD servers can no longer access MSSQL databases?

jaso9146
Posts: 29
Joined: Mon Jan 12, 2015 8:58 pm

Re: PHP7 - MSSQL ODBC on FreeBSD

Post by jaso9146 » Fri Nov 06, 2015 3:42 am

Update: I found out that the FreeTDS binary package does not come with libtdsodbc.so by default (it was compiled without the UNIXODBC option). If you want the libtdsodbc.so library/driver you will need to compile FreeTDS from source or by using ports. I have verified that this works but am checking to see if it is possible to distribute the package with the UNIXODBC option enabled to make this process easier. For those who do not want to mix packages and ports, another option is to compile FreeTDS on a separate box then transfer libtdsodbc.so to any boxes that need it. If you go this route, you will need to remember to manually update the driver in the future.

jaso9146
Posts: 29
Joined: Mon Jan 12, 2015 8:58 pm

Re: PHP7 - MSSQL ODBC on FreeBSD (Solved)

Post by jaso9146 » Tue Dec 08, 2015 4:44 am

Update: The UNIXODBC option is now enabled in the FreeTDS package so FreeBSD PHP users who connect to MSSQL databases do not need to compile anything.

Post Reply