Setting up the SQLite Database Driver

Problem

You want to use SQLite as your database.

You know SQLite is a "server-less" database and don't want to bother with setting up a database server.

Solution

Edit the app/config/database.php configuration.

<?php
return array(
    'default' => 'sqlite',
    'connections' => array(
        'sqlite' => array(
            'driver'   => 'sqlite',
            'database' => __DIR__.'/../database/production.sqlite',
            'prefix'   => '',
        ),
    ),
);
?>

Discussion

You must have the PHP Driver installed. See Installing SQLite for setting up the PHP driver.

In the above configuration example, line #7 points to your database. You may want to change this to your app/storage directory.

'database' => storage_path('production.sqlite'),

Or even create a folder within the storage directory.

$ mkdir app/storage/databases

Be sure to update your configuration to the new location.

'database' => storage_path('databases/production.sqlite'),
comments powered by Disqus