###前提・実現したいこと
HomesteadでSQLiteを使いたいです。
.env
DB_CONNECTION=sqlite DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=database/database.sqlite DB_USERNAME=homestead DB_PASSWORD=secret
config/database.php
'default' => env('DB_CONNECTION', 'sqlite'), 'connections' => [ 'sqlite' => [ 'driver' => 'sqlite', 'database' => env('DB_DATABASE', database_path('database.sqlite')), 'prefix' => '', ], (略)
下記のエラーを解消するにはどうしたらいいでしょうか。
全体の流れ
HomesteadでSQLiteを使いたいので、touchコマンドでdatabase/database.sqliteとSQLiteファイルを作成しました。その後php artisan migrateでマイグレーションをかけようとするとエラーが発生します。
###発生している問題・エラーメッセージ
下記のエラーが発生しました
Illuminate\Database\QueryException : could not find driver (SQL: select * from sqlite_master where type = 'table' and name = migrations) at C:\Users\admin80\LaravelProjects\marutora\vendor\laravel\framework\src\Illuminate\Database\Connection.php:664 660| // If an exception occurs when attempting to run a query, we'll format the error 661| // message to include the bindings with SQL, which will make this exception a 662| // lot more helpful to the developer instead of just the database's errors. 663| catch (Exception $e) { > 664| throw new QueryException( 665| $query, $this->prepareBindings($bindings), $e 666| ); 667| } 668| Exception trace: 1 PDOException::("could not find driver") C:\Users\admin80\LaravelProjects\marutora\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:68 2 PDO::__construct("sqlite:C:\Users\admin80\LaravelProjects\marutora\database\database.sqlite", []) C:\Users\admin80\LaravelProjects\marutora\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:68 Please use the argument -v to see more details.
###該当のソースコード
php artisan tinnkerでphpinfo();を実行して確認したところ、
PDO driversが空っぽになっています。
(略) PDO PDO support => enabled PDO drivers => (略)
###補足情報(言語/FW/ツール等のバージョンなど)
開発環境:Vagrant + VirtualBox / Homestead
本番環境:CentOS7 nginx MySQL PHP7.2
言語:PHP 7.2.3 (cli)(NTS)
フレームワーク:Laravel5.5 (LTS)
サーバー:nginx
DB:MySQL
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/05/11 03:20
退会済みユーザー
2018/05/11 03:31
2018/05/11 03:35
2018/05/11 05:12
2018/05/11 05:39