I am trying to install sqlite3 for PHP in Ubuntu.
I install apt-get php5-sqlite3
and edited php.ini
to include sqlite3 extension.
W
For Ubuntu 18.04 and PHP 7.2:
sudo apt install php-sqlite3
The accepted answer is not complete without the remainder of instructions (paraphrased below) from the forum thread linked to:
cd /etc/php5/conf.d
cat > sqlite3.ini
# configuration for php SQLite3 module
extension=sqlite3.so
^D
sudo /etc/init.d/apache2 restart
In Centos 6.7, in my case the library file /usr/lib64/php/modules/sqlite3.so was missing.
yum install php-pdo
vim /etc/php.d/sqlite3.ini
; Enable sqlite3 extension module
extension=sqlite3.so
sudo service httpd restart
For Debian distributions. Nothing worked for until I added the debian main repositories on the apt sources (I don't know how were they removed):
sudo vi /etc/apt/sources.list
and added
deb http://deb.debian.org/debian stretch main
deb-src http://deb.debian.org/debian stretch main
after that sudo apt-get update
(you can upgrade too) and finally sudo apt-get install php-sqlite3
The Debian/Ubuntu way for php-7.2, php-7.3 & php-7.4 (e.g. the [234]
part)
sudo apt install php7.[234]-sqlite
sudo phpenmod sqlite3
Be sure to note that on Windows Subsystem for Linux version 1 (WSL1) the (file-)locking system for SQlite is broken.
Try:
apt-get install php5-sqlite
That worked for me.