0

I successfully installed PHP 8.2 on a Raspberry Pi 4 and installed the SQLite extensions through apt. I uncommented the correct lines in php.ini. My PHP scripts can read SQLite files but can't write to them. The PHP scripts work on another machine.

To find out what is wrong I ran php test.php | grep sqlite where test.php contains <?php phpinfo(); ?>. I got:

PHP Warning:  PHP Startup: Unable to load dynamic library 'pdo_sqlite' (tried: /usr/lib/php/20220829/pdo_sqlite (/usr/lib/php/20220829/pdo_sqlite: cannot open shared object file: No such file or directory), /usr/lib/php/20220829/pdo_sqlite.so (/usr/lib/php/20220829/pdo_sqlite.so: undefined symbol: php_pdo_unregister_driver)) in Unknown on line 0
PHP Warning:  Module "sqlite3" is already loaded in Unknown on line 0
/etc/php/8.2/cli/conf.d/20-pdo_sqlite.ini,
/etc/php/8.2/cli/conf.d/20-sqlite3.ini,
PDO drivers => sqlite
pdo_sqlite
sqlite3
sqlite3.defensive => On => On
sqlite3.extension_dir => no value => no value

Sqlite3 and PDO SQLite drivers are installed.

3
  • What are the contents of 20-pdo_sqlite.ini and 20-sqlite3.ini? Sounds like you're trying to enable the module twice. Commented Jul 5 at 15:15
  • 2
    Make sure the SQLite files are writable
    – Ken Lee
    Commented Jul 5 at 15:21
  • Sqlite files are writable, and I never edited 20-* files Commented Jul 10 at 21:31

0

Browse other questions tagged or ask your own question.