Create SQLite database in memory Create SQLite database in memory sqlite sqlite

Create SQLite database in memory


You have to write

$db = new PDO('sqlite::memory:');

the trailing : is missing.


The PDO_SQLITE Data Source Name (DSN) is composed of the following elements:

The DSN prefix is sqlite:.

  • To access a database on disk, append the absolute path to the DSN prefix.

  • To create a database in memory, append :memory: to the DSN prefix.

Documentation


Not sure @ win permissions, but on *nix, SQLite needs write permision to the dir confining database files for temp files.