• <tfoot id='ECkIA'></tfoot>
      <bdo id='ECkIA'></bdo><ul id='ECkIA'></ul>

    <legend id='ECkIA'><style id='ECkIA'><dir id='ECkIA'><q id='ECkIA'></q></dir></style></legend>
    <i id='ECkIA'><tr id='ECkIA'><dt id='ECkIA'><q id='ECkIA'><span id='ECkIA'><b id='ECkIA'><form id='ECkIA'><ins id='ECkIA'></ins><ul id='ECkIA'></ul><sub id='ECkIA'></sub></form><legend id='ECkIA'></legend><bdo id='ECkIA'><pre id='ECkIA'><center id='ECkIA'></center></pre></bdo></b><th id='ECkIA'></th></span></q></dt></tr></i><div id='ECkIA'><tfoot id='ECkIA'></tfoot><dl id='ECkIA'><fieldset id='ECkIA'></fieldset></dl></div>

    1. <small id='ECkIA'></small><noframes id='ECkIA'>

      1. Laravel 到 SQL Server (sqlsrv).[PDOException] 找不到驱动程

        时间:2023-10-04

        <i id='8yPoN'><tr id='8yPoN'><dt id='8yPoN'><q id='8yPoN'><span id='8yPoN'><b id='8yPoN'><form id='8yPoN'><ins id='8yPoN'></ins><ul id='8yPoN'></ul><sub id='8yPoN'></sub></form><legend id='8yPoN'></legend><bdo id='8yPoN'><pre id='8yPoN'><center id='8yPoN'></center></pre></bdo></b><th id='8yPoN'></th></span></q></dt></tr></i><div id='8yPoN'><tfoot id='8yPoN'></tfoot><dl id='8yPoN'><fieldset id='8yPoN'></fieldset></dl></div>

        • <legend id='8yPoN'><style id='8yPoN'><dir id='8yPoN'><q id='8yPoN'></q></dir></style></legend>
            <tbody id='8yPoN'></tbody>
        • <small id='8yPoN'></small><noframes id='8yPoN'>

            • <bdo id='8yPoN'></bdo><ul id='8yPoN'></ul>
              <tfoot id='8yPoN'></tfoot>
                  本文介绍了Laravel 到 SQL Server (sqlsrv).[PDOException] 找不到驱动程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  介绍.我的 Laravel 应用程序使用的是 mysql,现在它需要托管在我工作的公司的网络中(我是一名远程工作者).而这家公司是微软的窥视者,所以我需要将 Laravel 集成到他们的 SQL Server 中.

                  Intro. My laravel app was using mysql, now it needs to be hosted in the network of the company I am working ( I am a remote-worker). And this company are Microsoft peeps, so I need to integrate the laravel to their SQL Server.

                  我的 .env 中有这个

                  I have this in my .env

                  DB_CONNECTION=sqlsrv
                  DB_HOST=ip.address.of.server
                  DB_PORT=3306
                  DB_DATABASE=my_db
                  DB_USERNAME=my_username
                  DB_PASSWORD=my_password
                  

                  使用php artisan migrate

                  错误:

                    [PDOException]
                    could not find driver
                  

                  我正在使用 Ubuntu,这是一个专为我设计的远程盒子(来自我的雇主).我之前曾尝试在我的 Laravel 应用程序中使用 sql server(使用我的 Windows PC).据我所知,我在 xampp php.ini 中编辑了一些文本.作为 Linux 新手,这对我来说太难了(因为我只使用 CLI).

                  I am using Ubuntu, a remote box dedicated for me (from my employer). I have tried using sql server in my laravel app before (using my Windows PC). As far as I remember, I edited some texts in the xampp php.ini. As a newbie Linux user, it is too hard for me (since i was using only CLI).

                  已编辑(新版本)

                  所以我已经获得了从 Ubuntu 到数据库服务器的连接.我使用了 sqlcmd -S -U <用户名>

                  So I already got the connectivity from Ubuntu to the Database server. I used the the sqlcmd -S <host> -U <username>

                  并且我测试了查询(例如 SELECT * from users_data)并且它有效.

                  and I tested the queries (such as SELECT * from users_data) and it works.

                  现在,我修改了 config/database.php 并添加了它.

                  Now, I modified the config/database.php and I added this.

                  'sqlsrv' => [
                                  'driver'   => 'MSSQL',
                                  'host'     => env('DB_HOST', 'host.of.the.database'),
                                  'database' => env('DB_DATABASE', 'my_database'),
                                  'username' => env('DB_USERNAME', 'my_username'),
                                  'password' => env('DB_PASSWORD', 'my_pass'),
                            'port'     => '1433',
                                  'prefix'   => '',
                              ],
                  

                  但是我遇到了一个错误:

                  but I got an Error:

                  [InvalidArgumentException]
                    Unsupported driver [MSSQL]
                  

                  MSSQL"是我用来配置 FreeTDS 的名称.

                  "MSSQL" is the name I use to configure the FreeTDS.

                  推荐答案

                  致后来者

                  确定你使用的 PHP 版本(我家目前使用的是 php 7.1,所以我安装了 php7.1-sybase)

                  Make sure of the PHP version you use (for me homestead currently using php 7.1, so I installed php7.1-sybase)

                  sudo apt-get install freetds-common freetds-bin unixodbc php7.1-sybase
                  

                  司机是

                  'sqlsrv' => [
                              'driver' => 'sqlsrv',
                              'host' => env('DB_HOST', 'localhost'),
                              'database' => env('DB_DATABASE', 'forge'),
                              'port' => env('DB_PORT', '1433'),
                              'username' => env('DB_USERNAME', 'forge'),
                              'password' => env('DB_PASSWORD', ''),
                              'charset' => 'utf8',
                              'prefix' => '',
                          ]
                  

                  您可以使用tsql确保连接信息正确

                  You can make sure that the connection information is correct using tsql

                  TDSVER=8.0 tsql -H Host -U Username -D DatabaseName -p 1433 -P Password
                  

                  这篇关于Laravel 到 SQL Server (sqlsrv).[PDOException] 找不到驱动程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:为什么 PDO_MySQL 不返回整数? 下一篇:致命错误:未捕获的异常 'Exception' 带有消息

                  相关文章

                  最新文章

                  1. <i id='5A2ny'><tr id='5A2ny'><dt id='5A2ny'><q id='5A2ny'><span id='5A2ny'><b id='5A2ny'><form id='5A2ny'><ins id='5A2ny'></ins><ul id='5A2ny'></ul><sub id='5A2ny'></sub></form><legend id='5A2ny'></legend><bdo id='5A2ny'><pre id='5A2ny'><center id='5A2ny'></center></pre></bdo></b><th id='5A2ny'></th></span></q></dt></tr></i><div id='5A2ny'><tfoot id='5A2ny'></tfoot><dl id='5A2ny'><fieldset id='5A2ny'></fieldset></dl></div>

                    <small id='5A2ny'></small><noframes id='5A2ny'>

                  2. <legend id='5A2ny'><style id='5A2ny'><dir id='5A2ny'><q id='5A2ny'></q></dir></style></legend>

                    • <bdo id='5A2ny'></bdo><ul id='5A2ny'></ul>

                    1. <tfoot id='5A2ny'></tfoot>