2014-07-06 76 views
0

無效當我去http://localhost/project/rights我得到下面的錯誤:別名「rights.RightsModule」是Yii的權限擴展

Alias "rights.RightsModule" is invalid. Make sure it points to an existing PHP file and the file is readable. 

我加倍檢查我的道路。我已經在模塊文件夾中有用戶擴展,它工作得很好。我從protected/modules/rights中提取了rights

,這是我的config/main.php文件:

<?php 
$sitedes = 'blah blah'; 
if($_SERVER['HTTP_HOST'] == 'localhost') 
{ 
    $dbhost = 'localhost'; 
    $dbname = 'dbproject'; 
    $dbuser = 'root'; 
    $dbpass = ''; 
} 

// uncomment the following to define a path alias 
// Yii::setPathOfAlias('local','path/to/local-folder'); 

// This is the main Web application configuration. Any writable 
// CWebApplication properties can be configured here. 
return array(
    'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..', 
    'name'=>'Project', 
    'timeZone' => 'Asia/Somewhere', 
    // preloading 'log' component 
    'preload'=>array('log'), 

    // autoloading model and component classes 
    'import'=>array(
     'application.models.*', 
     'application.components.*', 
     'application.modules.user.models.*', 
     'application.modules.user.components.*', 
     'application.modules.rights.*', 
     'application.modules.rights.components.*', 
    ), 

    'modules'=>array(

     'gii'=>array(
      'class'=>'system.gii.GiiModule', 
      'password'=>'gii', 
      // If removed, Gii defaults to localhost only. Edit carefully to taste. 
      'ipFilters'=>array('127.0.0.1','::1'), 
     ), 

     'user'=>array(
      # encrypting method (php hash function) 
      'hash' => 'md5', 

      # send activation email 
      'sendActivationMail' => true, 

      # allow access for non-activated users 
      'loginNotActiv' => false, 

      # activate user on registration (only sendActivationMail = false) 
      'activeAfterRegister' => false, 

      # automatically login from registration 
      'autoLogin' => true, 

      # registration path 
      'registrationUrl' => array('/user/registration'), 

      # recovery password path 
      'recoveryUrl' => array('/user/recovery'), 

      # login form path 
      'loginUrl' => array('/user/login'), 

      # page after login 
      'returnUrl' => array('/user/profile'), 

      # page after logout 
      'returnLogoutUrl' => array('/user/login'), 
     ), 

     'rights'=>array(
      'install'=>true, 
     ), 

    ), 

    // application components 
    'components'=>array(
     'user'=>array(
      'class'=>'RWebUser', // Allows super users access implicitly. 
     ), 
     'authManager'=>array(
       'class'=>'RDbAuthManager', 
     ), 

     'urlManager'=>array(
      'urlFormat'=>'path', 
      'showScriptName'=>false, 
      'rules'=>array(
       '<controller:\w+>/<id:\d+>'=>'<controller>/view', 
       '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>', 
       '<controller:\w+>/<action:\w+>'=>'<controller>/<action>', 
      ), 
     ), 


     /* 
     'db'=>array(
      'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db', 
     ), 
     */ 
     // uncomment the following to use a MySQL database 

     'db'=>array(
      'connectionString' => 'mysql:host='.$dbhost.';dbname='.$dbname, 
      'emulatePrepare' => true, 
      'username' => $dbuser, 
      'password' => $dbpass, 
      'charset' => 'utf8', 
      'tablePrefix' => 'fl_', 
     ), 

     'errorHandler'=>array(
      // use 'site/error' action to display errors 
      'errorAction'=>'site/error', 
     ), 
     'log'=>array(
      'class'=>'CLogRouter', 
      'routes'=>array(
       array(
        'class'=>'CFileLogRoute', 
        'levels'=>'error, warning', 
       ), 
       // uncomment the following to show log messages on web pages 
       /* 
       array(
        'class'=>'CWebLogRoute', 
       ), 
       */ 
      ), 
     ), 
    ), 

    // application-level parameters that can be accessed 
    // using Yii::app()->params['paramName'] 
    'params'=>array(
     // this is used in contact page 
     'adminEmail'=>'[email protected]', 
     'description'=>$sitedes, 
    ), 
); 

這一切似乎不錯,但它不工作。現在做什麼?

回答

0

我注意到權限文件夾的用戶文件夾權限是755和700。這是一個只讀文件夾。所以我將權限更改爲755,並得到另一個關於無法找到表的錯誤。下面的代碼被添加到authManager section,現在一切似乎工作得很好。

'connectionID'=>'db', 

此答案可能有助於他人。