简体   繁体   English

如何在 MAC 中为 Laravel 安装 mssql 驱动程序 (sqlsrv)?

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

Im trying to connect to mssql server from My Mac OS.我正在尝试从我的 Mac OS 连接到 mssql 服务器。 My application development OS is MAC.我的应用程序开发操作系统是 MAC。

I try to download the driver here , but it is not for MAC.我尝试在此处下载驱动程序,但它不适用于 MAC。

Can anyone shed some light on how to install the mssql driver for php/laravel in MAC?任何人都可以阐明如何在 MAC 中为 php/laravel 安装 mssql 驱动程序?

Change the default driver from mysql to将默认驱动程序从 mysql 更改为

 'default' => 'sqlsrv',

In sqlsrv array provide the correct details to you sql IP在 sqlsrv 数组中为您提供正确的详细信息 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?您需要有关此设置的帮助吗?

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/按照本指南 MS 已汇总安装必要的依赖项,以使用 SQL Server 创建 PHP 应用程序: https : //www.microsoft.com/en-us/sql-server/developer-get-started/php/mac/

If you have PEAR installed you can run the below command"如果您安装了 PEAR,则可以运行以下命令”

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*||"`

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM