Warning – Yii\base\errorexception

I am a beginner in yii. When I installed Yii2 from Archive File with basic application template and

navigated to /localhost/basic/web, I got the Warning - yii\base\ErrorException and mkdir(): Permission

denied. The detailed error messages are as follows:

  1. in /var/www/basic/vendor/yiisoft/yii2/yii/helpers/BaseFileHelper.php at line 337

  2. yii\base\Application::handleError()

  3. in /var/www/basic/vendor/yiisoft/yii2/yii/helpers/BaseFileHelper.php – mkdir() at line 337

  4. in /var/www/basic/vendor/yiisoft/yii2/yii/log/FileTarget.php – yii\helpers\BaseFileHelper::createDirectory() at line 70

  5. in /var/www/basic/vendor/yiisoft/yii2/yii/base/Object.php – yii\log\FileTarget::init() at line 49

  6. in /var/www/basic/vendor/yiisoft/yii2/yii/BaseYii.php – yii\base\Object::__construct() at line 383

  7. in /var/www/basic/vendor/yiisoft/yii2/yii/log/Logger.php – yii\BaseYii::createObject() at line 164

  8. in /var/www/basic/vendor/yiisoft/yii2/yii/base/Object.php – yii\log\Logger::init() at line 49

  9. in /var/www/basic/vendor/yiisoft/yii2/yii/BaseYii.php – yii\base\Object::__construct() at line 383

  10. in /var/www/basic/vendor/yiisoft/yii2/yii/base/Module.php – yii\BaseYii::createObject() at line 465

  11. in /var/www/basic/vendor/yiisoft/yii2/yii/base/Application.php – yii\base\Module::getComponent() at line 238

  12. in /var/www/basic/vendor/yiisoft/yii2/yii/base/Module.php – yii\base\Application::preloadComponents() at line 182

  13. in /var/www/basic/vendor/yiisoft/yii2/yii/base/Application.php – yii\base\Module::init() at line 208

  14. in /var/www/basic/vendor/yiisoft/yii2/yii/base/Object.php – yii\base\Application::init() at line 49

  15. in /var/www/basic/vendor/yiisoft/yii2/yii/base/Application.php – yii\base\Object::__construct() at line 156

  16. in /var/www/basic/web/index.php – yii\base\Application::__construct()

Fatal error: Uncaught exception ‘yii\base\InvalidConfigException’ with message ‘Unable to append to log file: /var/www/basic/runtime/logs/app.log’ in /var/www/basic/vendor/yiisoft/yii2/yii/log/FileTarget.php:91 Stack trace: #0 /var/www/basic/vendor/yiisoft/yii2/yii/log/Target.php(101): yii\log\FileTarget->export() #1 /var/www/basic/vendor/yiisoft/yii2/yii/log/Logger.php(213): yii\log\Target->collect(Array, true) #2 [internal function]: yii\log\Logger->flush(true) #3 {main} thrown in /var/www/basic/vendor/yiisoft/yii2/yii/log/FileTarget.php on line 91

Help me, please !

Now I’m solved this problem, just simple…

All works with rights on folders in Yii2.

chmod 777 assets/

chmod 777 runtime/

chmod 777 /web/assets/

:rolleyes: Good luck!

I had the same problem and your post solved it!!! thank you!

Hi. I follow your guide but on my yii2 don’t have folder runtime and web/assets and my error isn’t fixed.

what should I do ?

if you get this error:

chmod: cannot access `/web/assets/’: No such file or directory

you should

chmod 777 web/assets

I’m getting this same error, and chmodding those three directories wide open doesn’t help.

I also chowned the entire app directory to the Apache user.

Is there any way to know what path Yii is trying to create?