Hi i'm received the could not find driver error when trying to connect to sqlite via a php file. I've set permission to 777... PHP Version 5.2.16, i have the module install. any reason why its not finding the driver, also php.ini is showing the extension pdo.so and pdo_mysql.so installed.

PDO

PDO support enabled PDO drivers mysql

pdo_mysql

PDO Driver for MySQL, client library version 5.0.92

try { // Connect to the SQLite Database. $db = new PDO('sqlite:.subscribers.db'); } catch(Exception $e) { die('connection_unsuccessful: ' . $e->getMessage()); }

asked Jan 10, 2012 at 13:06

acctman's user avatar

2

I had to actually install the extension, and this is how i did

sudo apt install php-sqlite3

Your Common Sense's user avatar

answered Apr 13, 2017 at 1:47

onin's user avatar

4 Comments

sudo apt-get install php5-sqlite for php5 on Ubuntu server 14.04.5 LTS

2018-01-24T23:33:53.133Z+00:00

or sudo apt install php-sqlite3 for all variations of php7

2018-06-13T20:20:31.397Z+00:00

sudo apt install php8.0-sqlite3 if you use PHP 8.

2021-11-03T14:37:50.09Z+00:00

No need to specify PHP version, the command will auto get the latest version.

2026-01-03T13:09:02.15Z+00:00

You need

[PDO_SQLITE] extension=pdo_sqlite.so

to be enabled, for sqlite:.subscribers.db

or, for Windows:

[PHP_PDO_SQLITE] extension=php_pdo_sqlite.dll

And of course this extension in your ext directory.

Uwe Keim's user avatar

Uwe Keim

40.9k61 gold badges193 silver badges309 bronze badges

answered Jan 10, 2012 at 13:11

devdRew's user avatar

6 Comments

do i have to recompile php to get the pdo_sqlite.so extension?

2012-01-10T13:58:41.553Z+00:00

no, just add *.so file to ext dir, add few lines in php.ini and that's all

2012-01-10T14:03:11.693Z+00:00

ok i figured it out sudo pecl install pdo_sqlite did the trick i did pdo_mysql earlier sqlite did the trick.

2012-01-10T14:06:12.267Z+00:00

2013-06-18T11:56:24.833Z+00:00

I have edited /etc/php5/apache2/php.ini then i have restarted Apache (sudo service apache2 restart)

2015-05-05T22:09:08.757Z+00:00

On archlinux i had to do two things:

first install php-sqlite

pacman -S php-sqlite

after that in my php.ini file for me in /etc/php/php.ini i had to uncomment this line:

;extension=pdo_sqlite.so

by removing semicolon.

Dont forget to restart server.

answered May 15, 2017 at 18:46

JTC's user avatar

I am using a portable version of PHP on windows, using the inbuilt web server. I found the following steps helped:

Renaming php.ini-development to php.ini Uncommenting extension_dir = "ext" under [PHP] (around line 700) making sure the following lines are in the php.ini: [sqlite3] sqlite3.extension_dir = "ext" extension = sqlite3 extension = pdo_sqlite Running the php webserver with the following flag added on: - c C:\Path\to\PortablePHP\php.ini

So currently my php command is php -S localhost:8081 -c B:\Downloads\php-7.2.6\php.ini.

Keozon's user avatar

Keozon

1,0381 gold badge11 silver badges26 bronze badges

answered Jun 2, 2018 at 20:45

dylan-myers's user avatar

answered Jan 10, 2023 at 8:43

Abdull's user avatar

DB_CONNECTION=sqlite3 worked for me

answered Mar 30, 2024 at 11:50

Pouriya mahdavi Abdar's user avatar

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.