Skip to content

The config.php file reference

config.php in the ClientFence folder holds the settings ClientFence needs before it can read its database. This page lists every key, what it changes and where the admin area changes it. Most of them you never touch: the installer writes them, and the admin pages named below save the rest.

Change a setting in the admin area when the tables below name a page: it checks the value first. Edit the file by hand only for keys without a page, or when the admin area does not open.

  1. Copy config.php somewhere safe first. It holds the database password and info.salt, the key that decrypts saved settings: never share it or post it.
  2. Edit it as the site user, not as root, so it keeps its owner. Keep it valid PHP: one return [ ... ]; array, every value followed by a comma.
  3. Reload a page. ClientFence reads the file on every request, so most changes apply at once. If the server’s OPcache does not check files for changes, restart PHP.
  4. After changing the cache or twig keys by hand, clear the cache: Invalidate cache on the Cache tab of System → Settings → System, or the command below.
Terminal window
php console.php cache:clear

If the file has a PHP error or does not return an array, every page, cron and console.php stop with Your Configuration is Empty. Put your copy back, or fix the line, and reload.

Updates keep your values. After an update, ClientFence adds any new key with its default and removes keys it no longer uses.

Key Type, default What it does
security.mode text, strict strict makes the session cookie SameSite=Strict; any other value uses Lax. System Health warns when it is not strict.
security.force_https true/false, true Redirects plain HTTP requests to HTTPS and makes links and cookies use https://. The installer sets it from your site address. Keep it on.
security.trusted_proxies.enabled true/false, false Trusts the forwarded visitor address from the proxies listed below.
security.trusted_proxies.proxies list, empty Proxy addresses and ranges, such as 198.51.100.0/24.
security.trusted_proxies.headers text, x_forwarded aws_elb (X-Forwarded-For, Proto and Port), x_forwarded (also Host and Prefix), forwarded (RFC 7239) or traefik.
security.session_lifespan seconds, 7200 How long a signed-in session lasts after it starts. Cron also removes sessions idle this long.
security.session_regeneration_grace_period seconds, 300 How long the old session ID keeps working after ClientFence issues a new one, for example at sign-in.
security.perform_session_fingerprinting true/false, true Signs out a session that suddenly comes from another browser.
security.debug_fingerprint true/false, false Writes why a session failed that browser check to the PHP error log.
security.hosting_networks mode, always, never Sign-ups and orders from hosting and VPN networks: mode is off, hold or block; the lists hold network numbers.
security.fraud_check provider, account_id, key, limit, skip_active The fraud check on new orders. The key is stored encrypted, so change it only on its tab.

The proxies, the browser check and the hosting networks are changed on Security → Settings (Proxies and Sessions tabs), by Super Administrators. See Proxies, access lists and sessions. The fraud check is on the Fraud check tab of System → Settings → Orders, see Orders. The page checks proxy ranges and refuses ones wider than /8 (IPv4) or /16 (IPv6); the file does not.

Key Type, default What it does
url text The portal address without https://, with a trailing slash: billing.example.com/. Written by the installer. Change it when you move the portal to another address.
admin_area_prefix text, /admin The admin area address, such as /team-7k2. Set in the Security step of Quick setup (Admin address). System Health warns while it is /admin.
path_data folder The data folder: cache (cache/), logs (log/) and update state. Written by the installer. Uploads stay in data/uploads in the ClientFence folder.
update_branch text, release Keep release. ClientFence always updates from its own release feed; beta releases are chosen with Get beta releases on Update ClientFence. A security check warns about any other value.
interface_ip text, 0 The local address outgoing requests use. 0 is the server’s default.
custom_interface_ip text, empty A custom interface or address. It wins over interface_ip.

The two interface keys are saved on System → Settings → System, Network Interface tab. An update removes the unused top-level keys disable_auto_cron, debug, log_stacktrace and stacktrace_length (the last two move into debug_and_monitoring), and debug_and_monitoring.report_errors. See Choose an outgoing network interface.

Key Type What it does
info.salt text The encryption key for saved passwords, keys and module settings. Generated by the installer. Never change it: settings saved with another salt read as empty.
info.instance_id text This installation’s ID, shown as Instance ID on the About tab of System → Settings → System. Redis and Memcached caches use it so installations sharing a server do not mix.

After a restore, put the original config.php back first. See Restore a backup.

Key Type, default What it does
debug_and_monitoring.debug true/false, false Debug mode: shows errors with details (the full trace page to signed-in staff, PHP warnings to every visitor). The debug bar needs APP_ENV=dev as well.
debug_and_monitoring.log_stacktrace true/false, true In debug mode, also logs where an error happened.
debug_and_monitoring.stacktrace_length number, 25 How many lines that trace keeps.

Keep debug mode off on a live portal. See Logs and debugging.

Key Type, default What it does
maintenance_mode.enabled true/false, false Closes the client area and the store. The admin area stays open.
maintenance_mode.message text, empty Your message on the maintenance page.
maintenance_mode.redirect_url text, empty Sends visitors to another site instead, such as a status page.
maintenance_mode.allowed_ips list, empty IP addresses and ranges that still see the site.
maintenance_mode.allowed_urls list, empty Paths that stay open, such as /api/guest/example/* (* matches anything). File only.

Changed on System → Settings → System, Maintenance tab. Updates turn maintenance mode on while they run and put it back as it was. See Close the portal for maintenance.

Key Type, default What it does
i18n.locale text, en_US The default language.
i18n.auto_detect_locale true/false, true Uses the visitor’s browser language when it is installed.
i18n.timezone text, UTC The portal’s time zone, such as Europe/London. Staff and clients can choose their own for display; emails to someone without their own use this one.
i18n.date_format text, medium none, short, medium, long or full.
i18n.time_format text, short The same choices, for times.
i18n.datetime_pattern text, empty An ICU pattern such as dd.MM.yyyy HH:mm. It overrides the two formats above.

The language and browser detection are on the Localization tab of System → Settings → System (Default Locale, Automatic Browser Language Detection). The time zone and formats are file only. A wrong format name stops pages from loading.

Key Type, default What it does
db.driver text, pdo_mysql The only supported driver.
db.host text The database server, such as 127.0.0.1 or localhost.
db.port number, 3306 The database port.
db.name, db.user, db.password text The database and its user.
db.charset text, utf8mb4 Not in the file by default. utf8mb4, utf8 or latin1; keep utf8mb4.

The installer writes these. Change them by hand when the database moves or its password changes. The sample file reads them from the DB_HOST, DB_NAME, DB_USER, DB_PASS and DB_PORT environment variables; the installer writes the values themselves.

Key Type, default What it does
cache.driver text, filesystem filesystem, redis or memcached.
cache.redis.host, cache.redis.port 127.0.0.1, 6379 The Redis server.
cache.redis.password text, none The Redis password.
cache.redis.database number, 0 The Redis database number.
cache.redis.tls.enabled true/false, false Connects with TLS. Required when a password is set and the host is not this server.
cache.redis.tls.verify_peer, verify_peer_name true/false, true Check the server’s certificate and its name. Keep both on.
cache.redis.tls.cafile path, none A CA file for a certificate your server does not already trust.
cache.redis.tls.allow_self_signed true/false, false Accepts a self-signed certificate. Not for production.
cache.memcached.host, cache.memcached.port 127.0.0.1, 11211 The Memcached server.

Changed on System → Settings → System, Cache tab (Cache Backend), by Super Administrators: it tests the connection before saving. If Redis or Memcached cannot be reached later, ClientFence falls back to the file cache and writes the reason to the PHP error log. See Caching and speed.

Key Type, default What it does
twig.debug true/false, false Template debug mode. A security check warns when it is on.
twig.auto_reload true/false, true Recompiles a template when its file changes.
twig.cache folder Where compiled templates are kept, the cache folder in the data folder.
twig.strict_variables true/false, true A template that uses an unknown variable fails instead of printing nothing.

File only. Clear the cache after a change. See Themes and templates.

Key Type, default What it does
api.allowed_ips list, empty Addresses and ranges API keys may be used from. Empty allows all. The admin and client pages are not affected.
api.CSRFPrevention true/false, true Checks the CSRF token on API calls made from signed-in pages. Keep it on: a security check warns when it is off.
api.require_referrer_header true/false, false Refuses API calls whose Referer header does not start with the portal address.
api.log sources and days The API request log: api_key, webhook, staff, client (each true/false, all off by default) and days (default 30, up to 3650).

api.allowed_ips is on the Access lists tab of Security → Settings (API keys from these addresses only) and the log on its API log tab. See the API overview.

Key Type, default What it does
rate_limiter.enabled true/false, true Limits sign-in tries, password resets and API calls.
rate_limiter.whitelist_ips list, empty Addresses and ranges never rate limited.
rate_limiter.policies list, empty Your own limits. Each one overrides the built-in policy of the same name.

The never-limited list is on the Access lists tab of Security → Settings (Never rate limited). The policies and their names are in Rate limits.