dongyoufo5672 2016-06-14 13:49
浏览 35
已采纳

在Yii Framework中设置环境

I'm having trouble setting an Environment for Yii Framework. Probably is an easy task for someone who knows it, but the documentation of this ir rather poor and I couldn't solve it by myself. Any help would be apprecitated, I don't get to SO until I waste all my resources.

The error I get is:

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

My 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条回答 默认 最新

  • douzhuang2016 2016-06-14 15:50
    关注

    Is the Yii framework folder in the directory beside your local? Make sure that your site knows the location of the framework as that's where it will get all it's resources.

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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 web课程,怎么做啊😭没好好听课 根本不知道怎么下手
  • ¥15 做一个关于单片机的比较难的代码,然后搞一个PPT进行解释
  • ¥40 matlab简单代码修改补充
  • ¥15 python提取.csv文件中的链接会经常出现爬取失败
  • ¥15 数据结构中的数组地址问题
  • ¥15 maya的mel里,怎样先选择模型A,然后利用mel脚本自动选择有相同名字的模型B呢。
  • ¥15 Python题,根本不会啊
  • ¥15 会会信号与系统和python的来
  • ¥15 关于#python#的问题
  • ¥20 oracle RAC 怎么配置啊,配置