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 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题