Skip to content

Configuration Files

Arthu Santiago edited this page Nov 30, 2026 · 1 revision

Configuration Files

Besides the environment variables, KeyAnyWhere has PHP configuration files in config/. This page explains which one you may change, in which order they are merged, and how to create config/app_local.php when you need to change a setting. A production installation that follows this wiki doesn't need any change here: config/app.php already reads everything it needs from the environment variables and ships with debug off.

Which file to change

KeyAnyWhere has three layers of configuration. Knowing them avoids losing your changes on the next upgrade.

File Versioned Who changes it
config/app.php yes Nobody in an installation. It belongs to the project and is replaced on every upgrade.
plugins/<Plugin>/config/app.php in the plugin A local plugin, to change what it needs.
config/app_local.php no (ignored by Git) You. Optional: it only exists if you create it.

They are merged in this order, each one overriding the previous: config/app.php → plugins (in the order of config/plugins.php) → config/app_local.php. The merge is key by key (CakePHP Hash::merge), so app_local.php only needs the keys you change. A numbered list, such as a log engine's levels, is appended to rather than replaced.

Important

Never edit config/app.php. A change there conflicts with the next git checkout of a new version. Put it in config/app_local.php instead.

Create config/app_local.php in production

Only do this when you have a setting to change. Start from an empty file rather than from config/app_local.example.php: the example is made for development (it reads DEBUG, renames the session cookie so it works on http://localhost, and configures DebugKit).

cd /var/www/keyanywhere
printf '%s\n' '<?php' '// Local settings of this installation. Merged over config/app.php.' 'return [' '];' > config/app_local.php

Then add your keys between return [ and ];, for example with nano config/app_local.php. Check the syntax after every change:

php -l config/app_local.php

The command should print No syntax errors detected.

Common changes

Two examples of keys to add to the array returned by config/app_local.php.

Session length, in minutes (the default is 240):

'Session' => [
    'timeout' => 60,
],

SMTP settings that are not in environment variables:

'EmailTransport' => [
    'default' => [
        'host' => 'ssl://smtp.example.com',
        'port' => 465,
    ],
],

Every available key is described in the CakePHP configuration chapter and in the comments of config/app.php. Keys specific to KeyAnyWhere (Kaw.*) are in Extension Points.

Next step

Database Setup

Clone this wiki locally