0

Somehow most of my php artisan commands report an error:

    C:\Projects\bapestore>php artisan migrate

   Illuminate\Database\QueryException

  could not find driver (SQL: select * from information_schema.tables where table_schema = bapestore and table_name = migrations and table_type = 'BASE TABLE')

  at C:\Projects\bapestore\vendor\laravel\framework\src\Illuminate\Database\Connection.php:669
    665|         // If an exception occurs when attempting to run a query, we'll format the error
    666|         // message to include the bindings with SQL, which will make this exception a
    667|         // lot more helpful to the developer instead of just the database's errors.
    668|         catch (Exception $e) {
  > 669|             throw new QueryException(
    670|                 $query, $this->prepareBindings($bindings), $e
    671|             );
    672|         }
    673|

  1   C:\Projects\bapestore\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:70
      PDOException::("could not find driver")

  2   C:\Projects\bapestore\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:70
      PDO::__construct()

I just installed PHP7, Laravel, MAMP, MySQL Workbench locally on my Windows 10 to be able to practice more at home. (Lord, has that been an odyssee..) And now I am trying to connect my database, but the tutorial I follow uses a Mac OS.. so I can't follow the instructions there.

Can anyone understand that error?

Codebelle
  • 11
  • 3

2 Answers2

1

You are most likely missing a PHP extension. If you are able to locate your php.ini file, search for extension=mysqli or extension=pdo_mysql extensions. You may need to un-commment them to enable the extensions.

mllnd
  • 555
  • 3
  • 5
  • 16
  • I've enabled `extension=mysqli` the other extension was already enabled. Still get the same error message – Codebelle Mar 23 '20 at 12:13
0

Type in your terminal

php --ini

This command will tell the current path of your php.ini configuration file.

Uncoment the following lines in that file.

extension=php_pdo.dll
extension=php_pdo_mysql.dll
Leonardo
  • 791
  • 1
  • 5
  • 21
  • extension=pdo_mysql was already uncommented before I asked the question. There is no php_pdo... extension in my file. – Codebelle Mar 23 '20 at 19:08
  • Unfortunately not. Tried everything you said, and still get the same error message. – Codebelle Mar 25 '20 at 06:56
  • 1) In your .env file the code is DB_CONNECTION=mysql? 2) In your app/config/database.php is 'default' => env('DB_CONNECTION', 'mysql')? 3) Did you put whitespaces between the word extension and the equal sign? Like this extension = php_pdo.dll? extension = php_pdo_mysql.dll – Leonardo Mar 25 '20 at 12:44
  • Tell me if the command php -m shows that pdo_mysql is enabled. – Leonardo Mar 25 '20 at 12:45
  • Another possible change is first test extension_dir = "ext", if it not works, change to absolute path to something like extension_dir = "C:\php\ext" or extension_dir="C:\php". – Leonardo Mar 25 '20 at 13:00
  • I had to enable extension=pdo_mysql –  Nov 09 '21 at 08:40