Skip to content

Configuration file

Viames Marino edited this page May 21, 2018 · 7 revisions

The configuration file is named config.php and contains all constants required by Pair. In case of subsequent changes after the installation, you can edit it manually.

<?php

// product
define ('PRODUCT_VERSION', '1.0');
define ('PRODUCT_NAME', 'Your application name');
define ('BASE_URI', '/any_subpath_on_url');

// database
define ('DB_HOST', 'your_host');
define ('DB_NAME', 'your_name');
define ('DB_USER', 'your_user');
define ('DB_PASS', 'your_pass');

By creating different versions of the config.php file you can install your web project on different web servers for different purposes. This is useful, for example, to run a development version, a test version, and a production version.

Optional parameters

DB_UTF8

The definition of this constant may be necessary if there are restrictions in the MySQL configuration panel that do not allow all UTF-8 variables to be set as required. This forces all the character_set_* and collation_* configuration parameters of MySQL to the latest standards that support the extensive charset introduced by smartphones and tablets virtual keyboards. This also solves the problem of storing emoji chars in database fields.

define ('DB_UTF8', TRUE);

This constant is added by the installer automatically in case the database does not have the correct configuration to accommodate Pair.

UTC_DATE

The definition of the constant UTC_DATE can be omitted from the configuration. By default, the Pair framework converts dates to UTC TimeZone and stores them through the ActiveRecord child classes in accordance with the UTC TimeZone. Pair uses the PHP DateTime class to handle all dates and automatically executes their conversion when they are displayed to the user based on their TimeZone.

define ('UTC_DATE', FALSE);

Please add this line only if your application should store date according to your Time Zone instead of UTC. This may be easier in the case of applications used only by users who live in the same Time Zone.

Default timezone

If you are using Pair without forcing the UTC timezone (UTC_DATE = FALSE or undefined) and the default timezone was not specified in the php.ini you will get a configuration error. You can avoid the error by adding the following optional code line to the config.php file:

date_default_timezone_set('Europe/Rome');

You can customize the default timezone for your project by picking an entry from this list.

You can’t perform that action at this time.