1

I have followed the instructions on the tutorial for installation on Linux, but unfortunately the Unix ODBC dependencies are not available in the repos for Ubuntu 19.04.

https://docs.microsoft.com/en-us/sql/connect/php/installation-tutorial-linux-mac?view=sql-server-2017

I've managed even to compile the drivers with PECL and loading into my PHP cli and Apache (but the question is not about Apache or LAMP stack, is about the PHP drivers), but keeps telling me about the ODBC driver.

I'm not trying to install SQL Server itself, just the native and PDO drivers for PHP being able to connect to the database, which is managed by Azure. I'm not intereseted in a LAMP stack 'cause I don't need MySQL nor Apache, at this moment I'm trying to do Functional Automated Testing, and the deploy to production goes to an IIS Server.

3

1 Answer 1

3

There is another article within the Microsoft's documentation, called Installing the Microsoft ODBC Driver for SQL Server on Linux and macOS. I think the steps mentioned there are exactly what you are searching for.

For Ubuntu 19.04 they offer only Microsoft ODBC Driver 17 for SQL Server, here is the relevant part:

This article explains how to install the Microsoft ODBC Driver for SQL Server on Linux and macOS, as well as the optional Command-Line Tools for SQL Server (bcp and sqlcmd) and the unixODBC Development Headers.

Important: If you installed the v17 msodbcsql package that was briefly available, you should remove it before installing the msodbcsql17 package. This will avoid conflicts. The msodbcsql17 package can be installed side by side with the msodbcsql v13 package.

Ubuntu

sudo su 
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -

#Ubuntu 19.04
curl https://packages.microsoft.com/config/ubuntu/19.04/prod.list > /etc/apt/sources.list.d/mssql-release.list

exit
sudo apt-get update
sudo ACCEPT_EULA=Y apt-get install msodbcsql17
# optional: for bcp and sqlcmd
sudo ACCEPT_EULA=Y apt-get install mssql-tools
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
source ~/.bashrc
# optional: for unixODBC development headers
sudo apt-get install unixodbc-dev

Note

  • Driver version 17.2 or higher is required for Ubuntu 18.04 support.
  • Driver version 17.3 or higher is required for Ubuntu 18.10 support.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .