PHP 7.x connection with MSSQL server with MAMP

Amit Verma picture Amit Verma · Oct 6, 2016 · Viewed 9.2k times · Source

I am trying to connect mssql server to PHP 7.0.8 through MAMP. I have tried using freetds. On some blog people are saying to use pdo_dblib.so extension but it's not working.

Please guide me through the process of connection.

Answer

Pedro Santiago picture Pedro Santiago · Aug 29, 2018

For those who still have this problem:

/Applications/MAMP/bin/php/php7.2.1/bin/pecl install sqlsrv pdo_sqlsrv

Edit php.ini:

extension=sqlsrv.so
extension=pdo_sqlsrv.so

If necessary, use brew install autoconf if you don't have it already.