You are currently browsing Crystal’s documentation for the 0.4 version - Switch to version: 0.3

Configuration

Default configuration

The path to Crystal's database configuration file is

/path/to/Crystal/config/database.php

All configuration values are stored in multidimensional array with this structure:

$db['default']['hostname'] = "localhost";
$db['default']['username'] = "username";
$db['default']['password'] = "pass";
$db['default']['database'] = "database";
$db['default']['driver'] = "mysql";
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['db_log']   = TRUE;
$db['default']['char_set'] = "utf8";
$db['default']['dbcollat'] = "utf8_general_ci";
$db['default']['port'] = "port"; 


You can add multiple database connection details in the configuration file.More on this topic you can find in the Connection manager section.

Configuration variables

hostname - The hostname of your database server.

username - The username used to connect to the database.

password - The password used to connect to the database.

driver - The database type.ie: mysql

pconnect - TRUE/FALSE - Whether to use a persistent connection.

db_debug - TRUE/FALSE - Whether database errors should be displayed.

char_set - The character set used in communicating with the database.

dbcollat - The character collation used in communicating with the database.

port - The database port number. Used with the Postgres and MySQL drivers. If not specified: 5432 for PostgreSQL and 3306 for MySQL.

Depending on what database platform you are using (MySQL, Postgres, etc.) not all values are needed. For example, when using SQLite you will not need to supply a username or password, and the database name will be the path to your database file.