Was able to install the Microsoft ODBC driver 13.1 and mssql-tools on Amazon Linux after quite research. It automatically installed unixODBC-2.3.4 as dependency but not sure what is the path where it is installed.

(Research link: Installing ODBC driver 13 for MSSQL Server in Amazon Linux on EC2 instance)

Now, everything is installed but unable to find the next steps to be followed.

The driver extension needs to be present in php.ini so that it can be used in PHP code. (Checked phpinfo() but unable to find the driver details as it is not present in php.ini file)

Following is content of /etc/odbcinst.ini

[ODBC Driver 13 for SQL Server]
Description=Microsoft ODBC Driver 13 for SQL Server

Questions: Found the following note in existing php.ini

; Note: packaged extension modules are now loaded via the .ini files
; found in the directory /etc/php.d; these are loaded by default.

But I am unable to find any .ini file created for the ODBC driver installed.

  • Should file be created manually?
  • If yes, what should it be named?
  • Which extension needs to be included as I am unable to find any extension in php? Tried to include extension=/opt/microsoft/msodbcsql/lib64/libmsodbcsql-13.1.so.4.0 and restarted httpd process but no success.

Could anyone please help on which .so files needs to be added as extension in php.ini to enable the driver?

Unable to figure out what am I missing.

UPDATE1: Just checked that by sqlcmd utility, am able to connect to my sql server and get result successfully.

sqlcmd -S SERVERIP -U User -P pwd -d DatabaseName -Q "SELECT TOP 1 Id FROM dbo.MyTable;"

It means that driver is working but unable to connect via odbc due to missed mapping as mentioned above

  • Have asked the question on microsoft blog link too. Hope to get update. – Mrudang Vora Mar 23 '17 at 6:45
  • I use Amazon Linux, but I'm not a huge fan. Next time I'll use Ubuntu, it's much easier to get help and install packages. If you're not already wedded to AL perhaps something to consider. Can't help with your other problem sorry. – Tim Mar 23 '17 at 6:57
  • Unfortunately, would not be able to switch from Amazon Linux. – Mrudang Vora Mar 23 '17 at 7:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.