在mac上不允许使用sudo chown操作。

问题描述 投票:0回答:1

我得到了这个错误,我已经尝试按照许多指示,但它没有工作。请帮助我,谢谢!我已经运行 php artisan migrate 然后我得到了这个。

UnexpectedValueException 

  The stream or file "/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied

我试图用 sudo 但我得到了 "Operation not permitted"

$ sudo chown -R www:www storage
Password:
chown: storage/app/public/.gitignore: Operation not permitted
chown: storage/app/public: Operation not permitted
chown: storage/app/.gitignore: Operation not permitted
chown: storage/app: Operation not permitted
chown: storage/oauth-private.key: Operation not permitted
chown: storage/logs/laravel.log: Operation not permitted
chown: storage/logs/.gitignore: Operation not permitted
chown: storage/logs: Operation not permitted
chown: storage/framework/sessions/.gitignore: Operation not permitted
chown: storage/framework/sessions: Operation not permitted
chown: storage/framework/cache/data/cc/c4/ccc4da08b14ef486fe32b15c805b5e95c7f3122b: Operation not permitted
chown: storage/framework/cache/data/cc/c4: Operation not permitted
chown: storage/framework/cache/data/cc: Operation not permitted
chown: storage/framework/cache/data/38/69/386948609bc3c4027c0048b9ef1c7e61d23cf80a: Operation not permitted
chown: storage/framework/cache/data/38/69: Operation not permitted
chown: storage/framework/cache/data/38: Operation not permitted
chown: storage/framework/cache/data/.gitignore: Operation not permitted
chown: storage/framework/cache/data: Operation not permitted
chown: storage/framework/cache/.gitignore: Operation not permitted
chown: storage/framework/cache: Operation not permitted
chown: storage/framework/views/a49dd52a70c9462f11ab6afe053e3413ed2600cf.php: Operation not permitted
chown: storage/framework/views/ff9e533ffd309c883ff47b05a9b2849d3b9947cc.php: Operation not permitted
chown: storage/framework/views/.gitignore: Operation not permitted
chown: storage/framework/views: Operation not permitted
chown: storage/framework/testing/.gitignore: Operation not permitted
chown: storage/framework/testing: Operation not permitted
chown: storage/framework/.gitignore: Operation not permitted
chown: storage/framework: Operation not permitted
chown: storage/oauth-public.key: Operation not permitted
chown: storage: Operation not permitted
laravel xampp permission-denied
1个回答
1
投票

你应该改变目录的所有权,让你的当前用户作为所有者,webserver用户(www-data,apache,...)作为组。

chown -R $user:www-data [推荐]。

设置当前用户为所有者,webserver用户为组。

$ sudo chown -R $USER:www-data storage
$ sudo chown -R $USER:www-data 

bootstrap/cache 设置目录权限为775

$ chmod -R 775 storage
$ chmod -R 775 bootstrap/cache

chown -R 777 [不推荐]

你可以将两个目录设置为777。

$ chmod -R 777 storage
$ chmod -R 777 bootstrap/cache
© www.soinside.com 2019 - 2024. All rights reserved.