Yii2项目在Windows操作系统上运行良好但在linux OS

时间:2018-04-30 09:17:13

标签: php yii2

  

异常(无效配置)'yii \ base \ InvalidConfigException'   消息'Web进程无法写入目录:   的/ var / www / html等/ HRMS /网络/资产

     在/var/www/html/hrms/vendor/yiisoft/yii2/web/AssetManager.php:215

堆栈追踪:

#0 /var/www/html/hrms/vendor/yiisoft/yii2/base/BaseObject.php(108): yii\web\AssetManager->init()
#1 [internal function]: yii\base\BaseObject->__construct(Array)
#2 /var/www/html/hrms/vendor/yiisoft/yii2/di/Container.php(375): ReflectionClass->newInstanceArgs(Array)
#3 /var/www/html/hrms/vendor/yiisoft/yii2/di/Container.php(156): yii\di\Container->build('yii\\web\\AssetMa...', Array, Array)
#4 /var/www/html/hrms/vendor/yiisoft/yii2/BaseYii.php(349): yii\di\Container->get('yii\\web\\AssetMa...', Array, Array)
#5 /var/www/html/hrms/vendor/yiisoft/yii2/di/ServiceLocator.php(137): yii\BaseYii::createObject(Array)
#6 /var/www/html/hrms/vendor/yiisoft/yii2/base/Module.php(724): yii\di\ServiceLocator->get('assetManager', true)
#7 /var/www/html/hrms/vendor/yiisoft/yii2/base/Application.php(608): yii\base\Module->get('assetManager')
#8 /var/www/html/hrms/vendor/yiisoft/yii2/web/View.php(225): yii\base\Application->getAssetManager()
#9 /var/www/html/hrms/vendor/yiisoft/yii2/web/View.php(285): yii\web\View->getAssetManager()
#10 /var/www/html/hrms/vendor/yiisoft/yii2/web/AssetBundle.php(125): yii\web\View->registerAssetBundle('yii\\validators\\...')
#11 /var/www/html/hrms/vendor/yiisoft/yii2/validators/RequiredValidator.php(91): yii\web\AssetBundle::register(Object(yii\web\View))
#12 /var/www/html/hrms/vendor/yiisoft/yii2/widgets/ActiveField.php(763): yii\validators\RequiredValidator->clientValidateAttribute(Object(app\models\LoginForm), 'email', Object(yii\web\View))
#13 /var/www/html/hrms/vendor/yiisoft/yii2/widgets/ActiveField.php(230): yii\widgets\ActiveField->getClientOptions()
#14 /var/www/html/hrms/vendor/yiisoft/yii2/widgets/ActiveField.php(220): yii\widgets\ActiveField->begin()
#15 /var/www/html/hrms/vendor/yiisoft/yii2-bootstrap/ActiveField.php(187): yii\widgets\ActiveField->render('<input type="te...')
#16 /var/www/html/hrms/vendor/yiisoft/yii2/widgets/ActiveField.php(176): yii\bootstrap\ActiveField->render()
#17 /var/www/html/hrms/views/site/login.php(36): yii\widgets\ActiveField->__toString()
#18 /var/www/html/hrms/vendor/yiisoft/yii2/base/View.php(332): require('/var/www/html/h...')
#19 /var/www/html/hrms/vendor/yiisoft/yii2/base/View.php(250): yii\base\View->renderPhpFile('/var/www/html/h...', Array)
#20 /var/www/html/hrms/vendor/yiisoft/yii2/base/View.php(152): yii\base\View->renderFile('/var/www/html/h...', Array, Object(app\controllers\SiteController))
#21 /var/www/html/hrms/vendor/yiisoft/yii2/base/Controller.php(384): yii\base\View->render('login', Array, Object(app\controllers\SiteController))
#22 /var/www/html/hrms/controllers/SiteController.php(110): yii\base\Controller->render('login', Array)
#23 [internal function]: app\controllers\SiteController->actionLogin()
#24 /var/www/html/hrms/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#25 /var/www/html/hrms/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#26 /var/www/html/hrms/vendor/yiisoft/yii2/base/Module.php(528): yii\base\Controller->runAction('login', Array)
#27 /var/www/html/hrms/vendor/yiisoft/yii2/web/Application.php(103): yii\base\Module->runAction('site/login', Array)
#28 /var/www/html/hrms/vendor/yiisoft/yii2/base/Application.php(386): yii\web\Application->handleRequest(Object(yii\web\Request))
#29 /var/www/html/hrms/web/index.php(16): yii\base\Application->run()
#30 {main}

1. in /var/www/html/hrms/vendor/yiisoft/yii2/base/ErrorHandler.php at line 317
308309310311312313314315316317318319320321322323324325326

    /**
     * Converts an exception into a PHP error.
     *
     * This method can be used to convert exceptions inside of methods like `__toString()`
     * to PHP errors because exceptions cannot be thrown inside of them.
     * @param \Exception $exception the exception to convert to a PHP error.
     */
    public static function convertExceptionToError($exception)
    {
        trigger_error(static::convertExceptionToString($exception), E_USER_ERROR);
    }

    /**
     * Converts an exception into a simple string.
     * @param \Exception|\Error $exception the exception being converted
     * @return string the string representation of the exception.
     */
    public static function convertExceptionToString($exception)
    {

2. yii\base\ErrorHandler::handleError(256, 'Exception (Invalid Configuration...', '/var/www/html/hrms/vendor/yiisof...', 317, ...)
3. in /var/www/html/hrms/vendor/yiisoft/yii2/base/ErrorHandler.php at line 317 – trigger_error('Exception (Invalid Configuration...', 256)
4. in /var/www/html/hrms/vendor/yiisoft/yii2/widgets/ActiveField.php at line 178 – yii\base\ErrorHandler::convertExceptionToError(yii\base\InvalidConfigException)
5. in /var/www/html/hrms/views/site/login.php at line 36 – yii\widgets\ActiveField::__toString()

1 个答案:

答案 0 :(得分:0)

为根目录中的assets文件夹授予755权限,它将使文件夹可写。