简体   繁体   English

带有Laravel 5的Microsoft SQL Server

[英]Microsoft SQL Server with Laravel 5

I've just pushed a laravel application to an Ubuntu 16.04 VPS - the company is using SQL Server for record management - and I cannot get Laravel to connect to that database for authentication or anything else. 我刚刚将laravel应用程序推送到Ubuntu 16.04 VPS-该公司正在使用SQL Server进行记录管理-但我无法让Laravel连接到该数据库进行身份验证或其他操作。

I'm getting errors that say that Laravel cannot find the drivers to connect. 我收到错误消息,说Laravel无法找到要连接的驱动程序。

I've searched in too many places. 我搜索了太多地方。

There's no good tutorial that shows from start to finish, they're all using different packages and it's overwhelming. 从头到尾都没有很好的教程显示,他们都在使用不同的软件包,而且势不可挡。

Has anybody here successfully connected a laravel application (running on Ubuntu) to SQL Server? 这里有没有人成功地将laravel应用程序(在Ubuntu上运行)连接到SQL Server?

I have managed using below configuration (on windows): 我已经使用以下配置(在Windows上)进行了管理:

in .env file 在.env文件中

DB_CONNECTION=sqlsrv
DB_HOST=hots
DB_PORT=1433
DB_DATABASE=dbname
DB_USERNAME=user
DB_PASSWORD=password

Database.php 为database.php

'default' => env('DB_CONNECTION', 'sqlsrv'),

and in connections 和在connections

'sqlsrv' => [
            'driver' => 'sqlsrv',
            'host' => env('DB_HOST', ''),
            'port' => env('DB_PORT', '1433'), // note the port
            'database' => env('DB_DATABASE', ''),
            'username' => env('DB_USERNAME', ''),
            'password' => env('DB_PASSWORD', ''),
            'prefix' => '',
        ],

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

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