简体   繁体   中英

Laravel 5.4 on localhost: QueryException could not find driver (SQL: select * from `sessions`

I'm trying to run laravel 5.4 on localhost php 5.6 using XAMPP with these laravel .env configurations

DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=dbname_here
DB_USERNAME=root
DB_PASSWORD=

But I get QueryException could not find driver (SQL: select * from sessions

In log file

local.ERROR: PDOException: could not find driver in D:\xampp\htdocs\laravel\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\PDOConnection.php:43
Stack trace:
#0 D:\xampp\htdocs\laravel\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\PDOConnection.php(43): PDO->__construct('mysql:host=loca...', 'root', '', Array)

But PDO is already installed

I tried to clear the cache but that didn't solve the problem. Any ideas?

[update]

After an edit by changing "SESSION_DRIVER=file" Now I get

FatalThrowableError
Call to undefined function openssl_encrypt()

local.ERROR: Symfony\Component\Debug\Exception\FatalThrowableError: Call to undefined function openssl_encrypt() in D:\xampp\htdocs\laravel\vendor\laravel\framework\src\Illuminate\Encryption\Encrypter.php:78
Stack trace:
#0 D:\xampp\htdocs\laravel\vendor\laravel\framework\src\Illuminate\Session\EncryptedStore.php(57): Illuminate\Encryption\Encrypter->encrypt('a:3:{s:6:"_toke...')

Might be the issue of missing dependency. Try the following command:

composer require doctrine/dbal

and also comment-out the following line in your php.ini file:

;extension=pdo_mysql.so

Laravel 5 PDOException Could Not Find Driver

Also, if you haven't installed php-mysql driver, install it with following command (depending on PHP version):

sudo apt-get install php7.0-mysql

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