Ratha
Ratha

Reputation: 9692

How to install mssql driver (sqlsrv)for Laravel in MAC?

Im trying to connect to mssql server from My Mac OS. My application development OS is MAC.

I try to download the driver here, but it is not for MAC.

Can anyone shed some light on how to install the mssql driver for php/laravel in MAC?

Upvotes: 2

Views: 6603

Answers (2)

Larry
Larry

Reputation: 31

Follow this guide MS have put together to install the necessary dependencies to create PHP apps with SQL Server: https://www.microsoft.com/en-us/sql-server/developer-get-started/php/mac/

If you have PEAR installed you can run the below command"

sudo pecl install sqlsrv pdo_sqlsrv
sudo echo "extension= pdo_sqlsrv.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"`
sudo echo "extension= sqlsrv.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"`

Upvotes: 2

Simon
Simon

Reputation: 1190

Change the default driver from mysql to

 'default' => 'sqlsrv',

In sqlsrv array provide the correct details to you sql IP

  'sqlsrv' => array(
   'driver' => 'sqlsrv',
   'host' => ' ip adress', 
   'database' => 'database',
   'username' => 'root',
   'password' => '',
   'prefix' => '',
  ),

You can also addition key values to array if you like.

Found on. Do you need help with this set up?

Upvotes: 0

Related Questions