<?php $yii=dirname(__FILE__).'/../yii/framework/yii.php'; if($_SERVER['REMOTE_ADDR']=='127.0.0.1') { // , defined('YII_DEBUG') or define('YII_DEBUG',true); defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3); // $config=dirname(__FILE__).'/protected/config/develop.php'; } else { // $config=dirname(__FILE__).'/protected/config/main.php'; } require_once($yii); Yii::createWebApplication($config)->run();
<?php // // , function array_extends(array $array1, array $array2) { foreach($array2 as $key=>$value) { if(is_int($key)) $array1[]=$value; else if(empty($array1[$key]) || !is_array($value)) $array1[$key]=$value; else if(is_array($value)) $array1[$key]=array_extends($array1[$key], $value); } return $array1; } // //, , // return array_extends(include('main.php'), array( // 'name'=>'Local version', 'import'=>array( // import 'application.extensions.yiidebugtb.*' 'application.extensions.yiidebugtb.* ), 'modules'=>array( // gii ? 'gii'=>array( 'class'=>'system.gii.GiiModule', 'password'=>'password', ... ), ), 'components'=>array( 'db'=>array( // connectionString 'connectionString' => 'mysql:host=localhost;dbname=mycms', // . 'username' => 'root', // . 'password' => '', // 'enableProfiling'=>true, /* 'tablePrefix' => 'tbl_', */ ), 'log'=>array( // 'routes'=>array( array( 'class'=>'XWebDebugRouter', ... ), array( 'class'=>'CWebLogRoute', ... ), ) ), ), ));
<?php return array( 'name'=>'Working Version', ... 'import'=>array( 'application.models.*', 'application.components.*', ), 'modules'=>array( // uncomment the following to enable the Gii tool 'admin', ), ... // application components 'components'=>array( 'db'=>array( 'connectionString' => 'mysql:host=localhost;dbname=host_db', 'emulatePrepare' => true, 'username' => 'hosh_login', 'password' => 'hosh_password', 'charset' => 'utf8', 'tablePrefix' => 'tbl_', ), 'log'=>array( 'class'=>'CLogRouter', 'routes'=>array( array( 'class'=>'CFileLogRoute', 'levels'=>'error, warning', ), ), ), ), ... );
Source: https://habr.com/ru/post/125677/
All Articles