Laravel Sqlite 数据库无法连接

怪癖

当我导航到我的服务器(Ubuntu)上的应用程序时,我得到以下信息:

Data: { message: 'could not find driver (SQL: select * from "projects" order by "created_at" desc)',
  exception: 'Illuminate\\Database\\QueryException',
  file: '/root/project/api/vendor/laravel/framework/src/Illuminate/Database/Connection.php',
  line: 664,
  trace:
   [ { file: '/root/project/api/vendor/laravel/framework/src/Illuminate/Database/Connection.php',
       line: 624,
       function: 'runQueryCallback',
       class: 'Illuminate\\Database\\Connection',
       type: '->' },

但是在本地它有效。所以我想也许驱动程序没有安装,但是当我运行以下命令时,它显示我已经安装了 sqlite:

 sqlite3 -version
3.19.3 2017-06-08 14:26:16 0ee482a1e0eae22e08edc8978c9733a96603d4509645f348ebf55b579e89636b

我的数据库配置看起来像这样,默认是 sqlite:

'sqlite' => [
            'driver' => 'sqlite',
            'database' => env('DB_DATABASE', database_path('database.db')),
            'prefix' => '',
        ],

我下一步要弄清楚为什么这行不通?

乔尔·欣茨

您已经安装了 sqlite3,但没有安装 php 的驱动程序。该驱动程序也称为 sqlite3,因此对于例如 Ubuntu/Debian 来说,应该是sudo apt-get install php7.2-sqlite3.

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章