'Laravel - could not find driver (SQL: PRAGMA foreign_keys = ON;)

UPDATE: I figured out what's going out, The PHP server that I use run my electron app seems not loading pdo_sqlite extension while the global php executable on my system works when I execute "php artisan migrate" from the command line. So that there is a mismatch with those two PHP versions.

I ran into a strange issue after switching to my new device. The artisan command migrate is working but when I try to access a page that connect to the database I got this error "could not find driver (SQL: PRAGMA foreign_keys = ON;)"

My configuration are as shown below
Laravel 8.40
PHP 7.3 with enabled extensions

  • pdo_sqlite
  • sqlite3
  • pdo_mysql


Solution 1:[1]

sudo apt-get install php-sqlite3

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 cigien