Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

thesogafoi's avatar

i have problem with pdo_sqlite

Hey guys i am using ubuntu 18.01.1 LTS and i use linuxbrew for install valet on my pc , i use sqlite in my laravel but i get php warning and it doesnot work i install sqlite with brew and apt-get for ubuntu but still fail Here's my warning

PHP Warning:  PHP Startup: Unable to load dynamic library 'pdo_sqlite.so' (tried: /usr/lib/php/20180731/pdo_sqlite.so (/usr/lib/php/20180731/pdo_sqlite.so: undefined symbol: sqlite3_column_table_name), /usr/lib/php/20180731/pdo_sqlite.so.so (/usr/lib/php/20180731/pdo_sqlite.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP Warning:  Module 'sqlite3' already loaded in Unknown on line 0

i install php-sqlite and i get SQLite 3.x driver for PDO Wez Furlong in my phpinfo but still not work can u help me ?

0 likes
17 replies
mcangueiro's avatar

If you do

php -m

in your terminal do you see the extension sqlite3 and pdo_sqlite there?

thesogafoi's avatar

@SERGIU17 - I Did but it doesnot work php-sqlite3 is already the newest version (2:7.3+69+ubuntu18.04.1+deb.sury.org+2+php7.3)

thesogafoi's avatar

@SERGIU17 - i found i use php7.3 and i edit php.ini in etc/php/7.3/cli and enabled extension=pdo_sqlite And extension=sqlite3

still not work

Sergiu17's avatar

@THESOGAFOI - that's frustrated, a while ago, I had the same problem, I installed everything related to sqlite, sqlite3, php-sqlite, php7-slqlte :D just everything)) And it was starting to work somehow, did you restart your service after installations? sudo service apache2 restart ?

Cronix's avatar
etc/php/7.3/cli

You also need to enable it for the web version of PHP, in addition to the cli version. You only altered the cli version.

siangboon's avatar

@THESOGAFOI - Cronix mean the apache not just the cli such as /etc/php/7.2/apache2/php.ini

or run the command to find it

php -i | grep "Loaded Configuration File"
thesogafoi's avatar

@SIANGBOON - /etc/php/7.3/cli/php.ini its found here I turned on pdo_sqlite in php.ini but still not found

thesogafoi's avatar

also in my phpinfo() see same version Loaded Configuration File /etc/php/7.4/cli/php.ini

thesogafoi's avatar
thesogafoi
OP
Best Answer
Level 4

ty all i do not know why and how but i fixed by using 2 commands

cd /usr/local/lib

sudo mv libsqlite3.so.0 ./libsqlite3.so.0.back

2 likes
fannyhasbi's avatar

It works on my Ubuntu 18.04 (PHP 7.4) with these :

Before, I uncomment the extension=pdo_sqlite in php.ini file but nothing work. Then I installed php-sqlite3

sudo apt install php-sqlite3

Then, comment the extension=pdo_sqlite again in both /etc/php/7.4/cli/php.ini and /etc/php/7.4/apache2/php.ini then restart the server

sudo service apache2 restart

And finally it works

vendor/bin/phpunit
kroko's avatar

It sounds that your sqlite is built without the flag SQLITE_ENABLE_COLUMN_METADATA

  • Docs for flag is here

When this C-preprocessor macro is defined, SQLite includes some additional APIs that provide convenient access to meta-data about tables and queries.

  • It is also mentioned here

This enables some extra APIs that are required by some common systems, including Ruby-on-Rails.

... as well as aparently pdo_sqlite.so ^_^

Just purge linuxbrew sqlite and build from source. Keep OOB path suffixes....

sudo su
cd /usr/local/src
wget https://www.sqlite.org/2020/sqlite-autoconf-3330000.tar.gz
tar -xvzf sqlite-autoconf-3330000.tar.gz
cd sqlite-autoconf-3330000
CFLAGS="-O2 -DSQLITE_ENABLE_COLUMN_METADATA=1" ./configure
make
make install

Keep the /usr/local/src/sqlite-autoconf-3330000 so that you can make uninstall at any point.

Please or to participate in this conversation.