如何修复错误:laravel.log无法打开? [英] How to fix Error: laravel.log could not be opened?
问题描述
事实上,我在laravel中是一个新手,我正在尝试创建我的第一个项目.由于某种原因,我不断收到此错误(我什至还没有开始编码)
I'm pretty new at laravel, in fact and I'm trying to create my very first project. for some reason I keep getting this error (I haven't even started coding yet)
Error in exception handler: The stream or file "/var/www/laravel/app/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied in /var/www/laravel/bootstrap/compiled.php:8423
我读过这与权限有关,但是chmod -R 775 storage
根本没有帮助.
I've read this has something to do with permissions but chmod -R 775 storage
didn't help at all.
推荐答案
要解决此问题,您需要将目录的所有权更改为Web服务器使用的Unix用户.
To fix this issue, you need to change the ownership of the directory to the unix user that the webserver uses.
- 退出虚拟机
- 使用控制台,转到已同步的文件夹(无用)
- sudo chown -R $ USER:www-数据存储
- chmod -R 775存储
即使我使用VM用户在VM中创建了项目,该文件夹也属于真实计算机中的用户;因此,当尝试
Even though I created the project within the VM using the VM user, the folder belonged to the user in the real computer; so, when trying to
现在可以正常工作了.
感谢所有帮助我弄清楚这个问题的人
Thanks to all those that helped me figure this thing out
实际上,它仍然不起作用,仍然给我一个权限被拒绝"的问题.
Actually, it still wasn't working, it still gave me a "permission denied" problem.
这就是我所做的,我这样修改了Vagrantfile:
Here's what I did, I modified my Vagrantfile like this:
config.vm.synced_folder "./app","/var/www/", create:true,
:owner => "vagrant",
:group => "www-data",
:mount_options => ["dmode=775","fmode=664"]
这篇关于如何修复错误:laravel.log无法打开?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!