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.
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
[ODBC Driver 13 for SQL Server] Description=Microsoft ODBC Driver 13 for SQL Server Driver=/opt/microsoft/msodbcsql/lib64/libmsodbcsql-13.1.so.4.0 UsageCount=1
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.0and 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