问题
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
Permissions:-
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.
回答1:
I had same issue few days back.
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.
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.
This worked for me.
chgrp apache /path/to/yourdir
chmod g+w /path/to/yourdir
回答2:
See below:
-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
Try setting all the files within that folder to 777 as well.
来源:https://stackoverflow.com/questions/29179406/yii2-exception-invalid-configuration-yii-base-invalidconfigexception-with