Need to access and execute the MSSQL Stored Procedure from PHP code.
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: https://stackoverflow.com/a/31105561
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 packages.microsoft.com/config/rhel/6/prod.repo > /etc/yum.repos.d/mssql-release.repo
sudo yum remove unixODBC #to avoid conflicts
sudo ACCEPT_EULA=Y yum install msodbcsql-220.127.116.11-1 mssql-tools
But installer fails showing below error:
Error: msodbcsql conflicts with unixODBC-utf16-2.3.1-1.x86_64 Error: Package: msodbcsql-18.104.22.168-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
3) Hence, tried to install the unixODBC using http://www.unixodbc.org/
- Downloaded the package via curl - gunzip unixODBC*.tar.gz - tar xvf unixODBC*.tar
Then, used the following commands to install the same:
./configure make 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:
- Downloaded the .msi file for Microsoft ODBC Driver 13.1 for SQL Server - Windows + Linux
- 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?