Couldn't find driver exception when running php artisan migrate

59 Views Asked by At

I found a problem in my code like this:

Illuminate\Database\QueryException 

  could not find driver (Connection: mysql, SQL: select table_name as `name`, (data_length + index_length) as `size`, table_comment as `comment`, engine as `engine`, table_collation as `collation` from information_schema.tables where table_schema = 'sistem-inventory' and table_type in ('BASE TABLE', 'SYSTEM VERSIONED') order by table_name)

  at vendor\laravel\framework\src\Illuminate\Database\Connection.php:829
    825▕                     $this->getName(), $query, $this->prepareBindings($bindings), $e
    826▕                 );
    827▕             }
  ➜ 829▕             throw new QueryException(
    830▕                 $this->getName(), $query, $this->prepareBindings($bindings), $e
    831▕             );
    832▕         }
    833▕     }

  1   vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:65
      PDOException

I have already tried uncommenting these 2 lines in my php.ini but the error is still the same.

extension=pdo
extension=pdo_mysql

Any help would be appreciated. Thank you.

1

There are 1 best solutions below

1
drew010 On

PHP on Windows uses DLL files instead of so files. To enable this driver you'll need to use the following extension lines in your php.ini file:

extension=php_pdo.dll
extension=php_pdo_mysql.dll

These DLLs should exist in the system's extension_dir. They should be included with the Windows versions of PHP you have but if they weren't, you can get them from the appropriate PHP zip distribution at https://windows.php.net/download/