Attention

TYPO3 v10 has reached end-of-life as of April 30th 2023 and is no longer being maintained. Use the version switcher on the top left of this page to select documentation for a supported version of TYPO3.

Need more time before upgrading? You can purchase Extended Long Term Support (ELTS) for TYPO3 v10 here: TYPO3 ELTS.

Constants

Constants in TYPO3 define paths and database information. These values are global and cannot be changed. Constants are defined at various points during the bootstrap sequence.

Hint

Some constants (and global variables) are being replaced by more flexible mechanisms. A number of constants have been deprecated in TYPO3 9 and removed in TYPO3 10. Please see Environment. For a list of removed constants, see Removed Constants on this page.

To make the information below a bit more compact, namespaces were left out. Here are the fully qualified class names referred to below:

  • "SystemEnvironmentBuilder" = \TYPO3\CMS\Core\Core\SystemEnvironmentBuilder

  • "Bootstrap" = \TYPO3\CMS\Core\Core\Bootstrap

Check SystemEnvironmentBuilder::defineBaseConstants() for more constants.

Paths

TYPO3_mainDir

This is the directory of the backend administration for the sites of this TYPO3 installation. Hardcoded to typo3/. Must be a subdirectory to the website.

Defined in:

SystemEnvironmentBuilder::defineBaseConstants()

Available in Frontend:

Yes

Filetypes

Different types of files constants are defined in TYPO3\CMS\Core\Resource\AbstractFile. These constants are available for different groups of files as documented in https://www.iana.org/assignments/media-types/media-types.xhtml

These file types are assigned to all FAL resources. They can, for example, be used in Fluid to decide how to render different types of files.

Constant

Value

Description

FILETYPE_UNKNOWN

0

Unknown

FILETYPE_TEXT

1

Any kind of text

FILETYPE_IMAGE

2

Any kind of image

FILETYPE_AUDIO

3

Any kind of audio

FILETYPE_VIDEO

4

Any kind of video

FILETYPE_APPLICATION

5

Any kind of application

HTTP Status Codes

The different status codes available are defined in TYPO3\CMS\Core\Utility\HttpUtility. These constants are defined as documented in https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml

Legacy Constants

TYPO3_MODE

Mode of TYPO3: Set to either "FE" or "BE" depending on frontend or backend execution and context.

Important

About using TYPO3_MODE in ext_localconf.php and ext_tables.php:

It is recommended to AVOID checks for values on TYPO3_MODE or TYPO3_REQUESTTYPE constants (e.g. if (TYPO3_MODE === 'BE') within these files (ext_localconf.php and ext_tables.php) as it limits the functionality to cache the whole systems configuration. Any extension author should remove the checks if not explicitly necessary, and re-evaluate if these context-depending checks could go inside the hooks / caller function directly.

For more best practices of using these files, see Configuration Files (ext_tables.php & ext_localconf.php).

Defined in:
  • \TYPO3\CMS\Backend\Http\Application::defineLegacyConstants()

  • \TYPO3\CMS\Core\Console\CommandApplication::defineLegacyConstants()

  • \TYPO3\CMS\Frontend\Http\Application::defineLegacyConstants()

  • \TYPO3\CMS\Install\Http\Application::defineLegacyConstants()

Example:

"FE" or "BE"

Available in Frontend:

Yes, value = "FE"

Removed Constants

These constants were removed in TYPO3 10. You will find replacements in Environment.

String constants

  • TAB (Use "\t" instead)

  • NUL (Use "\0" instead)

  • SUB (Use chr(26) instead)

Paths constants

  • PATH_site: Use Environment::getPublicPath() to return the absolute path to the publically accessible folder (previously known as PATH_site) without the trailing slash.

  • PATH_thisScript: Use Environment::getCurrentScript() instead.

  • PATH_typo3: Use Environment::getPublicPath() . '/typo3/' instead.

  • PATH_typo3conf: Use Environment::getPublicPath() . '/typo3conf' instead

URL constants

  • TYPO3_URL_MAILINGLISTS

  • TYPO3_URL_DOCUMENTATION

  • TYPO3_URL_DOCUMENTATION_TSREF

  • TYPO3_URL_DOCUMENTATION_TSCONFIG

  • TYPO3_URL_CONSULTANCY

  • TYPO3_URL_CONTRIBUTE

  • TYPO3_URL_SECURITY

  • TYPO3_URL_DOWNLOAD

  • TYPO3_URL_SYSTEMREQUIREMENTS

Service constants

The according constants have been moved to class constants of TYPO3\CMS\Core\Service\AbstractService.

  • T3_ERR_SV_GENERAL

  • T3_ERR_SV_NOT_AVAIL

  • T3_ERR_SV_WRONG_SUBTYPE

  • T3_ERR_SV_NO_INPUT

  • T3_ERR_SV_FILE_NOT_FOUND

  • T3_ERR_SV_FILE_READ

  • T3_ERR_SV_FILE_WRITE

  • T3_ERR_SV_PROG_NOT_FOUND

  • T3_ERR_SV_PROG_FAILED

Other constants

  • TYPO3_OS (Use Environment::isWindows() and Environment::isUnix() instead)

  • TYPO3_REQUESTTYPE_CLI