状況
xamppを使用してLaravel7でアプリを作成し、Scout全文検索に使うTNTSearchをコンポーザーからインストールしようとしたら、エラーが出た。
XAMPP for Windowsのバージョンは 7.3.10
コマンドプロンプト
PC >> composer require teamtnt/tntsearch
Using version ^2.3 for teamtnt/tntsearch
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for teamtnt/tntsearch ^2.3 -> satisfiable by teamtnt/tntsearch[v2.3.0].
- teamtnt/tntsearch v2.3.0 requires ext-sqlite3 * -> the requested PHP extension sqlite3 is missing from your system.
To enable extensions, verify that they are enabled in your .ini files:
- C:\xampp\php\php.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
Installation failed, reverting ./composer.json to its original content
解決法
C:\xampp\php\php.iniの
- extension=pdo_sqlite (927行目)
- extension=sqlite3 (938行目)
のコメントアウトを外すと、いけた。
php.ini自体は重要な設定ファイルなので、編集前にphp.iniのバックアップファイルの作成を行うことをお勧めします。