![](/img/trans.png)
[英]The stream or file "/app/storage/logs/laravel.log" could not be opened: failed to open stream:Permission denied
[英]xampp ubuntu laravel The stream or file “/storage/logs/laravel log” could not be opened: failed to open stream: Permission denied
在ubuntu的xampp安装上安装了laravel。 在浏览器中打开它。 得到了错误:
流或文件/ storage / logs / laravel日志无法打开:打开流失败:权限被拒绝
怎么修? (我已经找到了答案,将立即发布)
问题是运行apache的用户无权访问该文件夹。 在ubuntu上的xampp中,主要apache进程的用户是root
。 但是apache worker在daemon
用户下运行。 解决方案是授予daemon
对/storage
目录的访问权限。 (如果您只授予/storage/logs
,则可以解决此错误,但是同级目录会发生相同的错误。因此, storage
本身文件夹:
sudo chown -R daemon /path-to-your-project/storage
现在, daemon
用户可以访问此文件夹(您没有但需要吗?如果您有更好的解决方案,请随时在此处共享它们!
添加到composer.json
"scripts": {
"post-install-cmd": [
"chgrp -R www-data storage bootstrap/cache",
"chmod -R ug+rwx storage bootstrap/cache"
]
}
然后运行composer install或更新以解决您的问题
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.