---
title: "getEnv"
manual: "TypoScript Explained"
version: "13.4"
permalink: "https://docs.typo3.org/permalink/t3tsref:getenv@13.4"
source: "Functions/GetEnv.rst"
rendered: "2026-09-17T16:31:34+00:00"
---

# getEnv {#getenv-1}

Allows to override static values with environment variables.

The modifier checks if the variable given as its argument is set and reads the
value if so, overriding any existing value. If the environment variable is not
set, the variable given on the left-hand side of the expression is not changed.

To have a value actually inserted, your PHP execution environment (webserver,
PHP-FPM) needs to have these variables set, or you need a mechanism like dotenv
(for example: [symfony/dotenv](https://github.com/symfony/dotenv) or
[vlucas/phpdotenv](https://github.com/vlucas/phpdotenv)) to set them in your
running TYPO3.

As it is a syntax feature you can use it in both constants and setup plus it
gets cached, as opposed to the [getText.getenv](https://docs.typo3.org/permalink/t3tsref:data-type-gettext-getenv@13.4)
feature.

## Example {#example}

**EXT:site_package/Configuration/TypoScript/setup.typoscript**

```typoscript
# Define default value
myConstant = defaultValue
# Enable overriding by environment variable
myConstant := getEnv(TS_MYCONSTANT)

```
