SQLite

SQLite is a lightweight database that is linked directly into software. The software serves as both the client and server to the database.

Pre-installed SQLite on DreamHost
SQLite 2.8.17 and 3.7.3, along with bindings for C, PHP, Perl, Python and Ruby, are pre-installed on DreamHost shared web hosting servers that are currently running Debian 6.0.4 (June 2013).

Performance is acceptable, and may be further improved by setting the appropriate parameters, e.g. the new Write-Ahead Logging may be enabled by using  (SQLite >= 3.7.0).

Note: To use SQLite3 with PHP, you must be using PHP 5.3 or higher. To switch PHP versions, go to the Dreamhost control panel -> Manage Domains and click Edit for the domain you're using and select PHP 5.3 FastCGI.

Installing SQLite in user’s directory (obsolete)
The following installation instruction was written in 2006 and is no longer necessary. It is kept here for historical interests, and for those who needs their own copy of SQLite for whatever reasons.

Prerequisites
Requires Environment Setup or Unix account setup to install correctly.

Choose an installation destination
If you use the Unix account setup you have already a  environment variable set up (in .bashrc) and you install everything there.

If you install packages directly in your home directory, then type: export RUN=${HOME}

If you install packages in other directory of your choice (e.g.  directly under your home directory - ), then type: export RUN=${HOME}/packages (replace packages above by the directory name you want).

Note where you installed it, since you'll probably need to know this when you want to configure other packages to use SQLite.

SQLite Version
Assign to an environment variable the version you want to install:

VERSION=2.8.17
 * Version 2 (historic)

VERSION=3.5.6
 * Version 3 (current)

You can install both versions. The command sqlite will be used for version 2 and sqlite3 for version 3.

Download SQLite
As recommended in the, create a separate build directory.

mkdir -pv ${HOME}/soft wget http://www.sqlite.org/sqlite-${VERSION}.tar.gz tar zxf sqlite-${VERSION}.tar.gz mkdir -pv sqlite-build-${VERSION} cd sqlite-build-${VERSION}

Set lib directory
Tell the installer where the lib directory will be placed, otherwise you will end up with a new executable that links to an old lib location:

LD_RUN_PATH=${HOME}/packages/lib

(change if you have a different install location than packages)

Configure
../sqlite-${VERSION}/configure --prefix=${RUN}

Troubleshooting: Locking Database Errors
If you get database locking errors than you need to use the --enable-threadsafe option when configuring.

../sqlite-${VERSION}/configure --prefix=${RUN} --enable-threadsafe

Installation
make make install

Create Link
(DON'T do this if you are installing both version 2 and version 3)

If sqlite3 exists but sqlite doesn't then create a link for it in the $RUN/bin folder.

Go to the directory that you installed sqlite to. cd ${RUN}/bin

Then create a symbolic link. ln -s sqlite3 sqlite