I'm trying to install and run PDO for sqlite3 on Ubuntu 20.04 with PHP 7.4 and I can't figure out what I'm not doing right. I installed sqlite3 and php-common and uncoment this lines in php.ini:
extension=pdo_sqlite
extension=sqlite3When run php, i receive following result:
php -i | grep sqlite
PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_sqlite' (tried: /usr/lib/php/20190902/pdo_sqlite (/usr/lib/php/20190902/pdo_sqlite: cannot open shared object file: No such file or directory), /usr/lib/php/20190902/pdo_sqlite.so (/usr/lib/php/20190902/pdo_sqlite.so: undefined symbol: php_pdo_unregister_driver)) in Unknown on line 0
/etc/php/7.4/cli/conf.d/20-pdo_sqlite.ini,
/etc/php/7.4/cli/conf.d/20-sqlite3.ini,
sqlite3
sqlite3.defensive => 1 => 1
sqlite3.extension_dir => no value => no valueThis is very strange to me because the file /usr/lib/php/20190902/pdo_sqlite.so exists. I also tested PHP7.3 and PHP7.2 and the result was the same. Switch between different versions of PHP with:
update-alternatives --config php 2 Answers
I had the same issue after upgrading to Ubuntu 20.04, too, and solved it by:
- Commenting back the two extensions in php.ini
- Installing php-sqlite3
I think uncommenting the extension lines in php.ini directly results in the extensions loading twice causing this issue.
please install sqlite for your php version,
for php7.4 follow below command
sudo apt install php7.4-sqlite3