简体   繁体   中英

pdo exception driver not found in laravel for sqlite

When I run php artisan migrate command I get:

[PDOException] could not find driver.

I made my default database as sqlite and checked whether there are pdo drivers for sqlite using php -i command. I could not understand my problem.

Your system has missing php SQLite installation.

Install it by using:

sudo apt-get install php7.0-sqlite

Then restart your apache server

sudo /opt/lampp/lampp restart

You need to install PDO on your server, or you might have to just comment out the following line in your php.ini file.

;extension=pdo_sqlite

(remove the ; character)

You should then restart your server.

If you are using sqlite and try to alter a table or drop a column you have to require doctrine/dbal , as suggested in the Laravel docs .

Just do a composer require doctrine/dbal and retry your migration.

For those using Windows and Xampp Just uncomment theses lines in php.ini :

extension=pdo_sqlite

extension=sqlite3

I'm using Laravel 5.3 and I had to comment out some params in .env file.

DB_CONNECTION=sqlite
# DB_HOST=127.0.0.1
# DB_PORT=3306
# DB_DATABASE=homestead
# DB_USERNAME=homestead
# DB_PASSWORD=secret

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM