在Yii Framework

时间:2016-06-14 13:49:42

标签: php yii yii2

我在为Yii Framework设置环境时遇到问题。对于那些知道它的人来说,可能是一件容易的事,但是这个文件很难用,而且我自己无法解决。任何帮助都会受到赞赏,在我浪费所有资源之前,我不会这样做。

我得到的错误是:

Fatal error: Uncaught exception 'Exception' with message '"SetEnv YII_ENVIRONMENT <mode>" not defined in Apache config.' in /home/(ommited)/app/extensions/Environment.php:235 
Stack trace: #0 /home/(ommited)/app/extensions/Environment.php(209): Environment->getMode(NULL, false) #1 /home/marcelo/myprojects/bocaweb/boca-sitioweb/html/index.php(10): 
Environment->__construct() #2 {main} thrown in /home/(ommited)/app/extensions/Environment.php on line 235

我的mode_development.php

<?php

return array(
    'yiiDebug' => false,
    'yiiTraceLevel' => 3,
    'configWeb' => array(
        'components' => array(// Database
            'mongodb' => array(
                'class' => 'EMongoClient',
                'server' => 'mongodb://(ommited)',
                'db' => '(ommited)',
                'RP' => array('RP_PRIMARY', array())
            ),
        ),
    ),
    'configConsole' => array(),
);

的index.php

<?php
error_reporting(E_ALL ^ E_NOTICE);
ini_set('display_errors', 1);



//Envirment and global
require_once(dirname(dirname(__FILE__)) . '/app/components/ArtfosEnvironment.php');
require_once(dirname(dirname(__FILE__)) . '/app/globals.php');
$env = new ArtfosEnvironment();

defined('YII_DEBUG') or define('YII_DEBUG', $env->yiiDebug);
defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL', $env->yiiTraceLevel);

require_once($env->yiiPath);
$env->runYiiStatics(); // like Yii::setPathOfAlias()
$yiiApp = Yii::createWebApplication($env->configWeb);
$yiiApp->run();

1 个答案:

答案 0 :(得分:0)

Yii framework文件夹是否在您本地旁边的目录中?确保您的网站知道框架的位置,以便获取所有资源。

尝试I would like to move yii framework folder outside of www access