简体   繁体   中英

Xampp won't connect with Sqlite: could not find driver

Some months ago, I started using sqlite through xampp. Worked perfectly fine. Then, I had to uninstall Xampp. After that, I just couldn't connect a database with Sqlite. It just keeps saying could not find driver .

In terminal, I did php -m . I could see pdo_sqlite in php modules. But also the following errors:

PHP Warning:  PHP Startup: Can't load module 'D:\Program Files\XAMPP\php\ext\sqlite3' as it's linked with 2.25, but the core is linked with 14.16 in Unknown on line 0

Warning: PHP Startup: Can't load module 'D:\Program Files\XAMPP\php\ext\sqlite3' as it's linked with 2.25, but the core is linked with 14.16 in Unknown on line 0

Then, I stored Sqlite3.exe in D:\Program Files\XAMPP\php\ext\sqlite3 but the error is still the same.

In php.ini , I uncommented the following:

extension=sqlite3
extension=pdo_sqlite
sqlite3.extension_dir = D:\Program Files\XAMPP\php\ext

Edit:

I added sqlite3.dll in the ext directory, and extension=php_sqlite3.dll in my php.ini . Now sqlite3 is showing in php -m , but when connecting still returning Could not find driver. And the same errors in the terminal

I found the solution. I didn't get to knew where the problem exactly was.

When I visited https://www.php.net/manual/en/sqlite3.requirements.php I saw that you need libsqlite3.dll . I went on more research. I had to copy libsqlite3.dll from the /php folder to the /apache/bin folder. That didn't solve the issues in the terminal, but it did connect to the Sqlite database.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM