PHP - SQLite Uncaught PDOException: could not find driver in

By xngo on September 15, 2019

Issue

I was trying to connect to SQLite database file using PDO but it is showing the following error message.

PHP Fatal error: Uncaught PDOException: could not find driver in ...

Solution

The cause was that the SQLite extension was not activated. To resolve this, I edited php.ini to change

;extension=pdo_sqlite

to

extension=C:\xuan\bin\php-7.3.8-Win32-VC15-x86\ext\php_pdo_sqlite.dll

From phpinfo(), you should get a section that look like the following.

phpinfo() - PDO for SQLite

About the author

Xuan Ngo is the founder of OpenWritings.net. He currently lives in Montreal, Canada. He loves to write about programming and open source subjects.