Need to access and execute the MSSQL Stored Procedure from PHP code.

Version details:

Local development machine - Windows 10 with XAMPP with PHP 7

Production system - Amazon AWS AMI Linux with PHP 5.3.2

What I require:

Want to use odbc connection to access the MSSQL on my LOCAL as well as LIVE server.

What I tried for LIVE server:

Wanted to make sure that the LIVE server is compatible to packages and am able to install the required packages correctly.

Hence, started with the following steps:

1) Looked in the link below where I found that we need to use ODBC for faster data access:

2) Tried to install following ODBC driver on Amazon Linux as mentioned below:

(Assuming that RHEL 6 installer would work on Amazon Linux too. Please let me know in case am incorrect)

  • Microsoft ODBC Driver 13.1 for SQL Server - Windows + Linux

sudo su curl > /etc/yum.repos.d/mssql-release.repo


sudo yum remove unixODBC #to avoid conflicts

sudo ACCEPT_EULA=Y yum install msodbcsql- mssql-tools

But installer fails showing below error:

Error: msodbcsql conflicts with unixODBC-utf16-2.3.1-1.x86_64
Error: Package: msodbcsql- (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

3) Hence, tried to install the unixODBC using

- Downloaded the package via curl
- gunzip unixODBC*.tar.gz
- tar xvf unixODBC*.tar

Then, used the following commands to install the same:

make install 

4) Restarted httpd service and again tried step 2 but installer failed with same error mentioned in point 2.

What I tried for LOCAL machine:

  1. Downloaded the .msi file for Microsoft ODBC Driver 13.1 for SQL Server - Windows + Linux
  2. Installed the same on my machine and restarted xampp apache. But am still getting Uncaught PDOException: could not find driver

UPDATE: Resolved the issue in local system by adding the extension dll in php.ini and restarted the server.

Could anyone please let me know what have I missed in LIVE configuration?

up vote 1 down vote accepted

Approach to solution

As the direct link for installation was not working, had downloaded rpm files for offline installation using below lines:

sudo mkdir /tmp/RedHat6Packages

sudo curl > /tmp/RedHat6Packages/msodbcsql-

sudo curl > /tmp/RedHat6Packages/mssql-tools-

Tried to install offline with following commands: cd /tmp/RedHat6Packages/ sudo yum localinstall msodbcsql- sudo yum localinstall mssql-tools-

But still was getting the same error: error: Failed dependencies: is needed by msodbcsql- unixODBC >= 2.3.1 is needed by msodbcsql- Found command to check the packages: sudo yum provides /usr/lib64/

This showed following warning:

Loaded plugins: priorities, update-motd, upgrade-helper
2 packages excluded due to repository priority protections
unixODBC-2.2.14-14.7.amzn1.x86_64 : A complete ODBC driver manager for Linux
Repo        : amzn-main
Matched from:
Filename    : /usr/lib64/    

unixODBC-utf16-2.3.1-1.x86_64 : ODBC driver manager with UTF16 character conversion enabled by default
Repo        : packages-microsoft-com-prod
Matched from:
Filename    : /usr/lib64/

JUMP directly to solution

Checked the below mentioned link:

What does that mean: packages excluded due to repository priority protections

Disabled priorities by editing /etc/yum/pluginconf.d/priorities.conf and set enabled = 0

Was able to install the driver using the same commands mentioned: cd /tmp/RedHat6Packages/ sudo yum localinstall msodbcsql- sudo yum localinstall mssql-tools-

Still unable to figure out where are extension files but have created other question (Next steps after installation of MSSQL ODBC 13.1 on Amazon EC2 Linux) as purpose of this question is solved.

As a newbie to linux (esp. who have migrated from windows), it was really difficult to find the above solution. Hope it helps someone!!

  • Setting enabled = 0 had no effect for me, but I installed the local RPM using "sudo rpm -ivh --nodeps mssql-tools-" instead of "sudo yum localinstall" – Chris May 11 '17 at 16:38

Here are the commands which should work for Amazon Linux AMI:

curl | sudo tee /etc/yum.repos.d/msprod.repo1
sudo yum remove unixODBC-utf16 unixODBC-utf16-devel
sudo yum info unixODBC*
sudo yum install mssql-tools unixODBC-devel
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' | tee -a ~/.bash_profile && source ~/.bash_profile

Source: Install sqlcmd and bcp the SQL Server command-line tools on Linux.

Otherwise, try to install older version which is not conflicting as per this post, e.g.

sudo ACCEPT_EULA=Y yum install msodbcsql- mssql-tools-

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.