25

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?

5 Answers 5

41

just do:

sudo apt-get install php5-sqlite

Next time, you can find it via:

apt-cache search php | grep sqlite
3
  • 3
    Thanks! Good to know how to search the package list via console. Didn't have cloue how to search for packets until now.
    – wowpatrick
    Aug 9, 2011 at 15:42
  • @wowpatrick: you welcome. Aug 10, 2011 at 6:43
  • 1
    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
    Dec 16, 2016 at 8:34
10

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

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

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

0
4

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

2

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
1
  • Thanks for very detailed and complete answer Jul 30, 2021 at 20:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .