Using PDO with PHP 7.3

Issue #383 new
Brain Forge created an issue

PHP application handles sqlite DB working fine on both Windows 10 and Centos 6 (out of date I know - that’s the problem!).

phpLiteAdmin works fine on Windows 10 but fails on Centos machine.

Reason - phpliteAdmin uses PDO in both cases which on the Centos machine does not support newer sqlite features. Solution - force phpliteadmin to ignore PDO and use SQLite3 instead. See FORCETYPE variable.

Could this be added to the config file?

Could lines 4392-4398 and 4399-4405 be swopped over so that it tries to find SQLite3 first? My preferred choice.

Comments (4)

  1. phpLiteAdmin repo owner

    Thank you for reporting. Have you tried using FORCETYPE? There is a line define("FORCETYPE", false); . Find that and replace it with define("FORCETYPE", "SQLite3"); . Does this fix your problem?

    Also, could you give more details what ‘fails on Centos machine' means? It should at least print some error message. Can you copy that?

    Normally, phpLiteAdmin checks whether PDO exists and the SQLite PDO driver. If your PDO SQlite3 driver is broken, you could remove it and phpLiteAdmin would use Sqlite3 automatically.

    What is the exact problem with the PDO driver of centos 6? Is it for SQlite2? Or is it an old version of sqlite3?

  2. Brain Forge reporter

    Error was : SQLite Error Malformed Database Schema

    On Centos 6 my application could see the DB no problem.
    Uses sqlite3 with PHP 7.3.

    On Centos 6 both command line sqlite and phpliteadmin could not list any tables.
    The command line and PDO version of sqlite did not support partial indexes - which my app uses.

    Able to extract the data and create a new DB from the Centos command line using…
    .mode insert
    .output dump_all.sql
    .dump

    The sql file contained the partial indexes - just had to change those lines before rebuilding.
    Quicker than getting the app to build DB from scratch…

  3. phpLiteAdmin repo owner

    Okay, I guess what we could do is: First try PDO, then try to list tables. If it fails with an error, try Sqlite3 (automatically).

  4. Log in to comment