Skip to content

Instantly share code, notes, and snippets.

@lennartvdd
Last active August 29, 2015 13:55
Show Gist options
  • Save lennartvdd/8706748 to your computer and use it in GitHub Desktop.
Save lennartvdd/8706748 to your computer and use it in GitHub Desktop.
Yii bootstrapper for server specific configurations (Yii 1.1.x)
<?php
//determine application environment
if(!defined('YII_ENV')) {
if(($env = getenv('YII_ENV'))===false) {
$env='production';//by default
}
define('YII_ENV', $env);
unset($env);
}
//get default & server config
$configMain = require(__DIR__ . '/protected/config/main.php');
$configServer = require(__DIR__ . '/protected/config/server.' . YII_ENV . '.php');
//merge and return config
return CMap::mergeArray($configMain, $configServer);
<?php
/* Yii Web Application Entry Script */
// default constants
defined('YII_DEBUG') or define('YII_DEBUG', false);
defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL', 3);
// define('YII_ENV', 'development'); //comment out or set OS Environment Variable YII_ENV. Default: production
// load framework
require_once(__DIR__ . '/../framework/yii.php');
// load configuration
$config = require('configure.php');
// start application
Yii::createWebApplication($config)->run();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment