How to install the SQLite PDO extension on Ubuntu

20

6

The default Ubuntu PHP package does not include the PDO SQLite extension. How can I install the SQLite PDO extension? Is there a package that one can easily install via apt-get?

wowpatrick

Posted 2011-08-09T14:43:28.537

Reputation: 3 039

Answers

30

just do:

sudo apt-get install php5-sqlite

Next time, you can find it via:

apt-cache search php | grep sqlite

Michał Šrajer

Posted 2011-08-09T14:43:28.537

Reputation: 2 495

Don't forget to restart your Apache server: "sudo service apache2 restart". You can check if sqlite is installed through a php webpage with a call to phpinfo(); or through command line by running "php -m" – Jan – 2016-12-16T08:34:27.153

1Thanks! Good to know how to search the package list via console. Didn't have cloue how to search for packets until now. – wowpatrick – 2011-08-09T15:42:49.087

@wowpatrick: you welcome. – Michał Šrajer – 2011-08-10T06:43:25.117

8

In ubuntu 16.04 there is no php5-sqlite. You need:

sudo apt-get install php7.0-sqlite
sudo service apache2 restart

Web Developer in Pune

Posted 2011-08-09T14:43:28.537

Reputation: 181

4

php5-sqlite - SQLite module for php5 php-mdb2-driver-sqlite - PHP PEAR module to provide a SQLite driver for MDB2

sac

Posted 2011-08-09T14:43:28.537

Reputation: 41

3

Just for clarification, I recently got into this issue, for php7.2 I had to run

sudo apt-get install php-sqlite3

which did install sqlite-3 there was no package named php-sqlite

Shobi

Posted 2011-08-09T14:43:28.537

Reputation: 131

1

First check your php version:

php -v

Then install the extension:

sudo apt-get install php[version-here]-sqlite3

For example, for PHP 7.2:

sudo apt-get install php7.2-sqlite3

Restart your apache server:

sudo service apache2 restart

List the modules and it should print sqlite:

php -m | grep sqlite

Luis Cabrera Benito

Posted 2011-08-09T14:43:28.537

Reputation: 111