Laravel与mssql(sqlsrv)无法连接 [英] Laravel with mssql (sqlsrv) not connecting
问题描述
我正在使用laravel和mysql正常工作.但是我现在有另一种情况.我需要将laravel连接到驻留在Windows服务器上的ms sql数据库.我已使用以下代码连接到数据库app/config/database.php
I was working on laravel with mysql it was working fine. But I have another scenario now. I need to connect the laravel to ms sql database which is reside on windows server. I have used the following code to connect to the DB app/config/database.php
'default' => 'sqlsrv',
'sqlsrv' => array(
'driver' => 'sqlsrv',
'host' => 'IP ADDRESS',
'database' => 'DB Name',
'username' => 'Username',
'password' => 'password',
'prefix' => '',
),
但显示错误提示
PDOException 找不到驱动程序
PDOException could not find driver
那么请问有人可以帮助我解决这个问题吗? 谢谢
So please can any one help me to solve this ? Thank you
推荐答案
您正在使用宅基地吗? 使用MAMP时,我遇到了完全相同的问题.服务器上缺少驱动程序,因此我最终切换到了宅基地并在那里安装了 freetds .
Are you using homestead? I had that exact same problem, using MAMP. The driver was missing from my server, so I ended up switching to homestead and installing freetds there.
这篇关于Laravel与mssql(sqlsrv)无法连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!