Exploring the various settings in TYPO3: A layered approach
As a robust enterprise content management system, TYPO3 maintains its settings and configurations in several distinct locations. Understanding these layers of configuration is crucial for effectively managing the system.
System-wide settings
These are settings relevant to the entire TYPO3 installation. While TYPO3 can manage thousands of different websites in a single installation (learn more about Multisite Management), fundamental configurations like image processing, database credentials, and email settings are part of these system-wide settings.
Developers can expand these settings within extensions—TYPO3’s method for enhancing its core functionality. They can even introduce custom system-wide configurations, which are stored alongside the default settings.
Site-specific settings
When operating multiple websites from a single TYPO3 installation, site-specific settings become incredibly useful. At b13, we often use these settings to designate specific storage folders, integrate custom CSS files, or manage various API tokens like Google Recaptcha. These site settings can be seamlessly converted into TypoScript constants, a feature that proves to be very practical (for more detail, see TypoScript Site Settings in the official documentation).
Per-page settings
TYPO3 organizes content within a hierarchical page tree, allowing for the definition or override of settings at the branch level. This is accomplished through TypoScript records (“sys_template”) stored in the database. At b13, we prefer to limit the use of TypoScript records as they cannot be version-controlled through Git, our preferred versioning system. Instead, we lean towards embedding most functionality in TypoScript files within extensions or using the “Site settings.”
Previous File Locations for System Settings in TYPO3
Since the release of TYPO3 v6.0, the primary configuration file for global system-wide settings was called LocalConfiguration.php. This file, structured as a PHP array, was unique in that it was never cached and resided under the TYPO3conf/ directory within the public folder. The contents of this file were directly loaded into $GLOBALS[TYPO3_CONF_VARS]. TYPO3 always loaded this file without being cached—a useful advantage. Plus: If it didn’t exist, TYPO3 would operate under the assumption of a fresh, new installation.
For configurations that required condition-based changes, there was an optional file named AdditionalConfiguration.php.
Back in 2012, this system of configuration was a significant step forward. However, it wasn’t without its drawbacks:
- Despite being a global configuration file, it curiously contained the word “Local” in its name.
- Being a pure PHP file, it posed potential security risks if stored outside the public document root of the web server. Misconfigurations could lead to severe security vulnerabilities, allowing unauthorized access to these files.
The installation method of TYPO3 also influenced file locations. With TYPO3 installed via Composer (“composer mode”), various source codes, including configuration files, resided outside the document root folder, usually called “public”, “web” or “htdocs”. Conversely, in the “classic mode,” where TYPO3 is installed from a tarball and unzipped on the server, PHP files could not easily be moved outside of the document root. However, in classic mode, it was still possible to restrict access to non-public folders using .htaccess files.
Introducing the New Configuration Location in TYPO3 v12
TYPO3 v9 marked a significant development with the introduction of per-site configuration capabilities, using a YAML file to house site-specific settings and custom configurations. In the classic mode of TYPO3, this file is typically located under TYPO3conf/sites/. A dedicated config folder was introduced for those running TYPO3 in Composer mode, generally positioned alongside the public or htdocs folder.
With the advent of TYPO3 v12, there’s a notable shift in how system-wide configurations are handled. These configurations have now been consolidated into a central location, within a newly created folder named /system/, situated under the main configuration directory. This change not only streamlines the configuration process but also aligns with the contemporary needs of TYPO3 administrators and developers.
For Composer Mode:
{project-root}/config/system/settings.php (previously LocalConfiguration.php)
{project-root}/config/system/additional.php (previously AdditionalConfiguration.php)
For Classic Mode:
{project-root}/htdocs/typo3conf/system/settings.php (previously LocalConfiguration.php)
{project-root}/htdocs/typo3conf/system/additional.php (previously AdditionalConfiguration.php)