phpsqlitepdo

How do I update PDO to use the latest sqlite3 version?


I want to use the latest version of sqlite (3.49.0 from this writing) in PHP.

I'm using docker and for latest docker image cli version (php:8.2-cli) sqlite3 shows the following version:

$ docker compose run --rm php php -r "echo SQLite3::version()['versionString'] . PHP_EOL;"
3.40.1

After I manually install the latest sqlite3 version via the following

RUN curl -L https://www.sqlite.org/2025/sqlite-autoconf-3490000.tar.gz | tar xz && \
    cd sqlite-autoconf-3490000 && \
    ./configure --prefix=/usr/local && \
    make && make install && \
    cd .. && rm -rf sqlite-*

I can see that sqlite3 is at latest version

$ docker compose run --rm php sqlite3 --version
3.49.0 2025-02-06

but the PDO version is still at older version:

$ docker compose run --rm php php -r "echo SQLite3::version()['versionString'] . PHP_EOL;"
3.40.1

Solution

  • You have to update the PDO extension, and specifically the sqlite3 driver extension of PDO with the updated libraries as well.

    PDO is part of core, you can find the source code here: https://github.com/php/php-src/?tab=readme-ov-file#building-php-source-code

    SQLite3 is already mentioned in the prerequisites before make.