Laravel 连接到 sql server
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23008924/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Laravel connection to sql server
提问by user3185936
Trying to connect laravel to my local sql server 2012. But getting error:
尝试将 laravel 连接到我的本地 sql server 2012。但出现错误:
This is the config file in laravel:
这是laravel中的配置文件:
'sqlsrv' => array(
'driver' => 'sqlsrv',
'host' => 'localhost',
'database' => 'nih_bw',
'username' => 'sa',
'password' => 'root',
'prefix' => '',
),
回答by hannesvdvreken
I think you need to install the PDO driver for MS SQL Server:
我认为您需要为 MS SQL Server 安装 PDO 驱动程序:
http://pecl.php.net/package/PDO_DBLIB
http://pecl.php.net/package/PDO_DBLIB
Install with the command:
使用以下命令安装:
pecl install PDO_DBLIB
If you are developing on a Windows machine:
如果您在 Windows 机器上开发:
http://pecl.php.net/package/pdo_sqlsrv
http://pecl.php.net/package/pdo_sqlsrv
Install with:
安装:
pecl install pdo_sqlsrv
回答by Raheel Hasan
on windows, you will need to install pdo_sqlsrv
from
http://php.net/manual/en/ref.pdo-sqlsrv.php
在 Windows 上,您需要pdo_sqlsrv
从
http://php.net/manual/en/ref.pdo-sqlsrv.php安装