Yii2 - 异常(无效配置)'yii\base\InvalidConfigException' 带有消息 'Web 进程无法写入该目录 [英] Yii2 - Exception (Invalid Configuration) 'yii\base\InvalidConfigException' with message 'The directory is not writable by the Web process

查看:74
本文介绍了Yii2 - 异常(无效配置)'yii\base\InvalidConfigException' 带有消息 'Web 进程无法写入该目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我访问 domain.com/web 上的站点时,显示此错误.我更改了目录权限,它们列在下面.有什么解决办法吗?

When I access the site at domain.com/web, I'm displayed this error. I changed the directory permissions and they are listed below. Any solution?

PHP User Error – yii\base\ErrorException

Exception (Invalid Configuration) 'yii\base\InvalidConfigException' with message 'The directory is not writable by the Web process: /var/www/.../site1/web/assets' 

in /var/www/.../site1/vendor/yiisoft/yii2/web/AssetManager.php:168

权限:-

root@...:/var/www/.../site1# ls -l web
total 48
drwxrwxr-x 9 root root 4096 Mar 20 15:56 assets
drwxr-xr-x 2 root root 4096 Mar 20 15:50 css

root@...:/var/www/.../site1/assets# ls -l
total 8
-rw-r--r-- 1 root root 958 Mar 20 17:24 AppAsset.php
-rw-r--r-- 1 root root 628 Mar 20 17:24 error_log

即使在运行此命令后:-

Even after running this command:-

chmod -R 777 .

total 8
-rwxrwxrwx 1 root root 958 Mar 20 17:24 AppAsset.php
-rwxrwxrwx 1 root root 628 Mar 20 17:24 error_log

我仍然遇到同样的错误.

I'm still getting same error.

推荐答案

几天前我遇到了同样的问题.

I had same issue few days back.

如果这之前可以正常工作,但突然出现此错误并停止工作,而不仅仅是重新启动 PC 并再次检查.否则执行以下操作.

If this was working earlier and suddenly got this error and stopped working than just restart your PC and check again. Else do the following.

为了使网络服务器可写目录,您必须将目录的所有者或组设置为 Apache 的所有者或组,并为其启用写入权限.通常,我们将目录设置为属于 Apache 组,并为该组启用写入权限.

In order to make a directory writable by the webserver you have to set the directory's owner or group to Apache's owner or group and enable the write permission for it. Usually, we set the directory to belong to the Apache group and enable the write permission for the group.

这对我有用.

chgrp apache /path/to/yourdir
chmod g+w /path/to/yourdir

这篇关于Yii2 - 异常(无效配置)'yii\base\InvalidConfigException' 带有消息 'Web 进程无法写入该目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆