Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install Microsoft Drivers for PHP for SQL Server on Amazon Linux AMI

I am trying to install Microsoft Drivers for PHP for SQL Server using the document provided by Microsoft. Link is https://github.com/Microsoft/msphpsql

It provides installation steps for Ubuntu and Redhat but not Amazon Linux. To install Microsoft Drivers on Amazon, I followed steps provided for Redhat ( not sure if it is correct). When I run the command

sudo ACCEPT_EULA=Y yum install msodbcsql mssql-tools

got the below error

Error: Package: msodbcsql-13.1.7.0-1.x86_64 (packages-microsoft-com-prod)
           Requires: unixODBC >= 2.3.1
           Available: unixODBC-2.2.14-14.7.amzn1.i686 (amzn-main)
               unixODBC = 2.2.14-14.7.amzn1

The error clearly says that to install msodbcsql, unixODBC version should be >= 2.3.1. But the updated/latest unixODBC package available for amazon is unixODBC-2.2.14.

I need some help to install Microsoft Drivers for PHP on Amazon Linux so that I can use Sqlsrv PHP functions to connect SQL server.

PHP7, Apache, and SQL server are already set up.

like image 447
Ravinder Reddy Avatar asked May 24 '26 02:05

Ravinder Reddy


1 Answers

After googling and trying all the ways, I found the answer to my own question.

Instead of using

sudo ACCEPT_EULA=Y yum install msodbcsql mssql-tools

I used

sudo ACCEPT_EULA=Y yum install msodbcsql-13.0.1.0-1 mssql-tools-14.0.2.0-1

and the issue fixed.

like image 115
Ravinder Reddy Avatar answered May 26 '26 15:05

Ravinder Reddy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!