Skip to the content
Documentation
Help Start
Reading in:
  • German: 9,059 of 9,059 pages
About the help in other languages
All help pages

.ini.append.php files and keeping settings safe

Why override files are PHP, which settings files hold secrets, file modes, what never goes into version control or into an extension, and how to check that settings cannot be read from the web.

Download as PDF

Address: https://doc.exponential.earth/exphelp/viewer/help/extension-development/part-2-builder/append-php-files-and-safety.md

On this page

.ini.append.php files and keeping settings safe

Part 2, chapter 7. Settings files are configuration, and some of them are secrets. This chapter explains how the system protects them and what you must do so that your extensions and your repositories never leak them. The facts come from Security hardening and INI files keep their permissions.

Why the PHP wrapper

An override file is named <file>.ini.append.php and wraps its INI text in a PHP comment:

<?php /* #?ini charset="utf-8"?

[DatabaseSettings]
Database=mysite

*/ ?>

If a web server is ever misconfigured and serves the file directly, PHP runs it, the comment produces no output, and the visitor sees an empty page instead of your settings. Always use this form for override files, and keep the closing */ ?> on the last line.

The files that hold secrets

FileSecret
settings/override/site.ini.append.phpthe database user and password ([DatabaseSettings])
settings/override/audit.ini.append.phpthe audit signing key and pseudonym key
settings/override/mailpreferences.ini.append.phpthe site secret [SecretSettings] TokenSecret
settings/override/velocity.ini.append.php[DashboardSettings] Token, when set
config.env.phpmachine settings
var/log/initial-admin-passwordthe first administrator password of a console or kickstart install

Some of these are generated on first use, so a development installation grows them too. They are all under settings/override/ or outside settings/ for exactly that reason.

Rules for builders and extension authors

  1. Never commit settings/override/. In a Git clone of the kernel, git status lists it as untracked; leave it so, add it to your own .gitignore or .git/info/exclude, and stage files by name rather than with git add -A.
  2. Never put a secret into an extension. Extensions are shared, packaged and published. An extension that needs a key should read it from a setting the installation fills in its own settings/override/, and ship the setting empty with a comment explaining it.
  3. Never copy settings between servers wholesale. Copy the blocks you need; leave database and secret blocks to each server.
  4. Mask secrets in output. exp:ini and the settings page mask variables named like Password, Secret, Token, Salt or ending in Key. Name your own secret settings the same way and they are masked too.
  5. Do not log settings. A debug line that prints a whole block can print a password.

The package download of Setup > Extensions refuses to pack an extension that holds a secret value or key material, and names the files and settings it found; see the secret check.

File modes

eZINI::save() gives a new settings file the mode 0640 and the owner and group of its directory; an existing file keeps its mode. Check that nothing is world-writable:

find settings extension/*/settings -name '*.ini*' -perm -o+w

It must print nothing. Fix what it lists with chmod 0640 (or 0644 where another user must read the file).

Can the web read your settings?

The document root of Exponential is the installation root, and the rewrite rules send requests for settings/, var/ and the sources to index.php, which answers with a page or a 404, never the file. Check your server:

curl -s -o /dev/null -w '%{http_code}\n' https://www.example.com/settings/site.ini
curl -s -o /dev/null -w '%{http_code}\n' https://www.example.com/settings/override/site.ini.append.php

Neither may return the file's contents. The full list of addresses to test is in Security hardening.

A safe settings extension, summarized

In the extension (committed)In settings/override/ (never committed)
design, languages, image aliases, overrides, view cache rulesdatabase, mail server credentials
your extension's own options, with safe defaultsAPI keys, tokens, secrets
comments explaining each settinghost names, paths, debug switches per server

Become an Exponential Partner

Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.

Something wrong on this page? Report an error

Documentation license

This documentation is free documentation, licensed under the GNU Free Documentation License 1.3 or later.

Exponential Copyright © 1998-2026 Exponential Foundation and 7x