Created
January 18, 2017 07:28
-
-
Save h3nn3s/8954a47ebba3aa88dac4654305e943a7 to your computer and use it in GitHub Desktop.
Small PHP script to set TYPO3_CONTEXT environment variable via php.ini setting for auto_prepend_file. Sets context depending on current subdomain (dev. or www.)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$host = getenv('SERVER_NAME'); | |
$patternDev = '/^dev\./'; | |
$patternProduction = '/^www\./'; | |
if (preg_match($patternDev, $host)) { | |
putenv('TYPO3_CONTEXT=Development'); | |
} | |
if (preg_match($patternProduction, $host)) { | |
putenv('TYPO3_CONTEXT=Production'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment