24

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
  • 4,199
  • 7
  • 31
  • 40

5 Answers5

40

just do:

sudo apt-get install php5-sqlite

Next time, you can find it via:

apt-cache search php | grep sqlite
Michał Šrajer
  • 2,855
  • 1
  • 20
  • 14
  • 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 09 '11 at 15:42
  • @wowpatrick: you welcome. – Michał Šrajer Aug 10 '11 at 06: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 '16 at 08:34
10

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

sudo apt-get install php7.0-sqlite
sudo service apache2 restart
Ganesh Bhosale
  • 201
  • 2
  • 4
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

Shobi
  • 201
  • 2
  • 4
4

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

sac
  • 41
  • 1
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