PDO_SQLITE driver not present.. what to do?
Asked Answered
G

6

50

I see everywhere (including on the official docs) that the PDO_SQLITE driver is/should be included by default in PHP.

However, when I look at my extension_directory, I see only these files:

gd.so mcrypt.so mysqli.so mysql.so pdo_mysql.so pdo.so

And, as a result, a framework I'm trying to install (Symfony) tells me I need to install either the PDO_SQLITE or the SQLite3 .so extensions...

Can anyone help? Can I just try and find the needed .so file somewhere on the web, place it in my extensions_directory and then include it in php.ini??

BTW: I'm running php 5.3.6 downloaded via apt-get on ubuntu.

Gauguin answered 11/1, 2012 at 15:46 Comment(0)
C
106

did you try sudo apt-get install php5-sqlite?

Current version: sudo apt install php7.4-sqlite

Carnap answered 11/1, 2012 at 15:56 Comment(13)
I never cease to be amazed at just how simple linux is... Thanks for that.. Silly of me not to have thought of that first thing off. However. Shouldn't this SQLITE thing be available as default?Gauguin
you're welcome! according to the docs it should be. but in my fedora install i had to install it by hand, though it was strange because it was enabled in php.ini, but like you said the driver was not present anywhere...Carnap
The sqlite module is availalbe after a PHP build from sources. But Linux distros often do their own thing. Most every module is available in their repositories - and most need to be explicitly installed.Negotiation
And for PHP7, you need to run: sudo apt-get install php7.0-sqlite3Camorra
Thanks worked fine for me with PHP 5.5.9-1ubuntu4.17 :-)Laundress
And for PHP 7.1, you need to run: sudo apt-get install php7.1-sqlite3Cornel
And of PHP 7.2: sudo apt-get install php7.2-sqlite3Sad
I think the above specifies the php 5 version, you will need to do something like this for the other greater php versions e.g. sudo apt-get install php7.2-sqlite3Deirdredeism
Similarly for PHP 7.3 use sudo apt-get install php7.3-sqlite3Hyps
for me sudo apt-get install php-sqlite3 works fine with php 7.2Louvain
php-sqlite3 should automatically update with php.Intercut
E: Couldn't find any package by regex 'php7.1-sqlite3'Orthoscope
Just so you know, php5-sqlite has been deleted from Ubunutu repositories.Rarity
F
34

For PHP 7.0 and greater:

sudo apt-get install php-sqlite3
Fencer answered 20/2, 2019 at 15:46 Comment(3)
Or sudo apt-get install php7.X-sqlite , where X is the correponding number of of your fpmGifu
E: Unable to locate package php-sqlite3Orthoscope
It's ok to add you php version but you still need to add the 3 after sqliteCentrifuge
J
9

For Windows users:

removed comment (;) from php.ini

extension=php_pdo_sqlite.dll

extension=php_sqlite3.dll
Jabot answered 8/5, 2018 at 10:18 Comment(0)
D
5

In my case i was using php 7.2 in Ubuntu. I had to run following command,

sudo apt install php7.2-sqlite
Developer answered 13/6, 2019 at 8:48 Comment(1)
E: Couldn't find any package by regex 'php7.2-sqlite'Orthoscope
K
1

For Windows 10 - 64bits, version PHP 7.2 It's necessary remove only ( ; ) Before ;extension=pdo_sqlite ;extension=sqlite3

After extension=pdo_sqlite extension=sqlite3

Restart the server and already.

Killam answered 7/2, 2019 at 14:54 Comment(1)
Not universally. 7.3.9 works; 7.4.14 not so much. Same for the Rajput (above) 'solution.'Miniver
K
1

For PHP 8.1.2

sudo apt install php8.1-sqlite3

Krasnodar answered 7/4, 2023 at 10:38 Comment(1)
Thanks! And unsurprisingly, for php 8.2 it's apt install php8.2-sqlite3 :)Johnniejohnny

© 2022 - 2024 — McMap. All rights reserved.