(laravel 8, php 7.4) PDOException::("could not find driver") on windows

Viewed 511

I am trying to migrate for the first time and am getting the below error. Any help will be appreciated.

 PS C:\Users\lenovo\Desktop\projects\instalar> php artisan migrate
    
       Illuminate\Database\QueryException
    
      could not find driver (SQL: select * from information_schema.tables where table_schema = instalar and table_name = migrations and table_type = 'BASE TABLE')
    
      at C:\Users\lenovo\Desktop\projects\instalar\vendor\laravel\framework\src\Illuminate\Database\Connection.php:678
        674▕         // If an exception occurs when attempting to run a query, we'll format the error
        675▕         // message to include the bindings with SQL, which will make this exception a
        676▕         // lot more helpful to the developer instead of just the database's errors.
        677▕         catch (Exception $e) {
      ➜ 678▕             throw new QueryException(
        679▕                 $query, $this->prepareBindings($bindings), $e
        680▕             );
        681▕         }
        682▕
    
      1   C:\Users\lenovo\Desktop\projects\instalar\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:70
          PDOException::("could not find driver")
    
      2   C:\Users\lenovo\Desktop\projects\instalar\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:70
          PDO::__construct()

here is my .env mysql settings

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=instalar
DB_USERNAME=root
DB_PASSWORD= ffgjjyufgf`

database.php

 'mysql' => [
        'driver' => 'mysql',
        'url' => env('DATABASE_URL'),
        'host' => env('DB_HOST', '127.0.0.1'),
        'port' => env('DB_PORT', '3306'),
        'database' => env('DB_DATABASE', 'forge'),
        'username' => env('DB_USERNAME', 'forge'),
        'password' => env('DB_PASSWORD', ''),
        'unix_socket' => env('DB_SOCKET', ''),
        'charset' => 'utf8mb4',
        'collation' => 'utf8mb4_unicode_ci',
        'prefix' => '',
        'prefix_indexes' => true,
        'strict' => true,
        'engine' => null,
        'options' => extension_loaded('pdo_mysql') ? array_filter([
            PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
        ]) : [],
    ],

some posts suggested that the problem could be in my php.ini but I closed checked it out but I think it is ok from the solution they offered. Below is my php.ini:

extension_dir="/xampp/php/ext"   

extension=mysqli
;extension=oci8_12c  ; Use with Oracle Database 12c Instant Client
;extension=odbc
;extension=openssl
;extension=pdo_firebird
extension=php_pdo_mysql
extension=pdo_mysql
;extension=pdo_oci
;extension=pdo_odbc
;extension=pdo_pgsql
extension=pdo_sqlite
;extension=pgsql
;extension=shmop
0 Answers
Related