0
votes

I get this error

PDOException: could not find driver

/var/www/html/RMTracker/vendor/illuminate/database/Connectors/Connector.php:55

In lumen while i'am trying to run phpunit test.

I tried everithing reinstall php, adding exstensions. Any idea how to solve this

1
to what db is it trying to connect? you probably just need the right extension (ex. pdo-mysql)ivcandela

1 Answers

0
votes

Please check in your config/database.php for which connection which driver is configured. The driver should of course match the DB type, i. e.

'connections' => [

        'sqlite' => [
            'driver' => 'sqlite',
            'database' => env('DB_DATABASE', database_path('database.sqlite')),
            'prefix' => '',
        ],

        'mysql' => [
            'driver' => 'mysql',
            'host' => env('DB_HOST', 'localhost'),
            'port' => env('DB_PORT', '3306'),
            'database' => env('DB_DATABASE', 'forge'),
            'username' => env('DB_USERNAME', 'forge'),
            'password' => env('DB_PASSWORD', ''),
            'charset' => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix' => '',
            'strict' => false,
            'engine' => null,
        ],
...

If you use a MySql DB use the driver mysql. Make sure you have the pdo_mysql PHP-extension installed in your environment or if using an sqlite DB the sqlite PHP extension.