PHPackages                             b13/environment - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. b13/environment

ActiveTypo3-cms-extension[Utility &amp; Helpers](/categories/utility)

b13/environment
===============

Configure multiple environments for TYPO3

1.0.8(10y ago)1211.9k3[2 issues](https://github.com/b13/t3ext-environment/issues)MITPHP

Since Dec 12Pushed 5y ago15 watchersCompare

[ Source](https://github.com/b13/t3ext-environment)[ Packagist](https://packagist.org/packages/b13/environment)[ Docs](https://github.com/b13/t3ext-environment)[ RSS](/packages/b13-environment/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (5)Used By (0)

TYPO3 Extension Environment
===========================

[](#typo3-extension-environment)

Created by Benjamin Mack, b:dreizehn GmbH, in 2013. Published under the MIT license.

What does it do?
----------------

[](#what-does-it-do)

The TYPO3 extension "Environment", compatible with TYPO3 CMS 4.5 until TYPO3 CMS 7.99.99, allows for context-specific settings, so the TYPO3 installation has different options for each context. This means that all logging and debugging settings can be turned on for the development environment.

Of course, this extension makes most sense if you have multiple server scenarios and a local development environment.

Installation
------------

[](#installation)

1. Install the extension.
2. Add the following Rewrite statements to your .htaccess file after the RewriteBase statement or to your Apache webserver configuration.

    Make sure the context variable is set with every http request
    =============================================================

    [](#make-sure-the-context-variable-is-set-with-every-http-request)

    RewriteCond %{HTTP\_HOST} ^(.\*)staging-system.org$ RewriteRule .? - \[E=TYPO3\_CONTEXT:Production/Staging\]

    RewriteCond %{HTTP\_HOST} ^(.\*)development-system.org$ RewriteRule .? - \[E=TYPO3\_CONTEXT:Development\]
3. Add the following code to your typo3conf/AdditionalConfiguration.php for TYPO3 CMS &gt;= 6.0

    // load the environment / context configuration for this installation if (\\TYPO3\\CMS\\Core\\Utility\\ExtensionManagementUtility::isLoaded('environment')) { include('ext/environment/Includes/Bootstrap/InitializeContext.php'); }

3a) For installations prior to 6.0, please include this at the bottom of the localconf.php

```
// load the environment / context configuration for this installation
if (t3lib_extMgm::isLoaded('environment')) {
	include('ext/environment/Includes/Bootstrap/InitializeContext.php');
}

```

3b) For installations using TYPO3 CMS 6.2+, just add this to your typo3conf/AdditionalConfiguration.php

```
// load the environment / context configuration for this installation
include('ext/environment/Includes/Bootstrap/InitializeContext.php');

```

After that, you have a PHP constant named "TYPO3\_CONTEXT" that is set to the environment variable placed in your server settings.

4. You can now define context-specific configurations, and create files like

- typo3conf/AdditionalConfiguration.Development.php
- typo3conf/AdditionalConfiguration.Production.php

and add configuration options like different DB settings and debugging settings, that get included depending on what context you have set in your server settings. Examples are provided in [Resources/Public/Examples](https://github.com/b13/t3ext-environment/tree/master/Resources/Public/Examples).

Please make sure that the PHP files always start with the following lines

```
