如何修复错误:laravel.log 无法打开? [英] How to fix Error: laravel.log could not be opened?

查看:44
本文介绍了如何修复错误:laravel.log 无法打开?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

事实上,我对 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.

  1. 离开虚拟机
  2. 使用控制台,转到您的同步文件夹(vagrant)
  3. sudo chown -R $USER:www-data storage
  4. 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屋!

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