DavMaxwel's avatar

PDOException: could not find driver

Hi! I am using Laravel with Laragon on windows 10, php 7.4, everything is working fine except when I run

phpunit --filter it_fetches_a_feed_for_any_user

Then I get

Illuminate\Database\QueryException: could not find driver (SQL: PRAGMA writable_schema = 1;)

If I look down on the error message printed I also see

Caused by
PDOException: could not find driver

Any Assistance will be appreciated.

I have checked php.ini and extension=pdo_mysql is enabled. In laragon settings, PDo_Mysql is checked.

Suggestions online says I should run

sudo apt-get install sqlite php-sqlite3

But this code doesn't work on windows,

Thanks

0 likes
7 replies
Sinnbeck's avatar

Try enabling it

 Menu > PHP > Extensions (find and enable sqlite)
Sinnbeck's avatar

What db are you using in phpunit.xml?

And never used laragon, but do you maybe need to restart the terminal?

DavMaxwel's avatar

PHPUnit DB Settings

        <env name="DB_CONNECTION" value="sqlite"/>
        <env name="DB_DATABASE" value=":memory:"/>

Yes I restarted apache, php and the terminal

Sinnbeck's avatar

Can you perhaps show a screenshot of all modules to do with pdo or sqlite (3)?

1 like
DavMaxwel's avatar

Thanks Sir. After realizing there is a setting here

<env name="DB_CONNECTION" value="sqlite"/>

I have it resolved by turning on pdo_Sqlite.

Thanks once more

Sinnbeck's avatar

Sounds good. Please mark a best answer to set the thread as solved

Please or to participate in this conversation.