How to update the SQLite version bundled with PHP

pdo, php, sqlite, windows

Solution

I could produce a fresh php_pdo_sqlite.dll to drop into an existing PHP 5.5 Windows installation that includes the current version (3.8.1) of SQLite:

I followed the nice step-by-step guide to build PHP on Windows using Visual Studio 2012 Express (available from http://www.microsoft.com/en-us/download/details.aspx?id=34673).

In the PHP 5.5 sources, I have replaced the outdated sqlite amalgamation file `ext\sqlite3\libsqlite\sqlite.c` by the current one from http://www.sqlite.org/download.html.

I used `configure --enable-pdo=shared --with-pdo-sqlite=shared`.

This creates `php_pdo_sqlite.dll` that I could drop into an existing PHP 5.5 installation, replacing the previous (bundled) version of that file.

<?php
$dbh = new PDO('sqlite:test1.sqlite');
print_r("SQLite version " . $dbh->query('select sqlite_version()')->fetch()[0]);
$dbh = null;
?>

confirms:

SQLite version: 3.8.1

Problem

PHP 5.5 comes bundled with SQLite 3.7.7.1. There have been ~ 20 newer releases of SQLite since then, and www.sqlite.org recommends to upgrade. In my case, I need a feature available only since SQLite 3.8.0. As far as I understood, SQLite is not dynamically linked in PHP 5.5 but the sqlite source code is compiled into the built-in PHP PDO driver for SQLite. Is there a way to use a current SQLite version in PHP without rebuilding PHP from source (e.g., somehow dynamically linking sqlite.dll)?

Original source