dongran1779 2014-08-06 02:24
浏览 51
已采纳

流浪汉盒子上的Laravel重复出现权限问题

I'm getting some strange permissions problems. I'm using Laravel on a vagrant box. I regularly have to reset my app/storage permissions.

Here's my process:

  • in terminal, run sudo chmod -R 777 app/storage. I do this both from the vagrant ssh and directly on my machine.

  • everything loads fine.

  • I run a login script that looks like this:

    public function store()
    {
    $input = Input::all();
    
    $attempt = Auth::attempt([
        'email' => $input['email']
        , 'password' => $input['password']
    ]);
    
    if($attempt){
        return Redirect::intended('/');
    }else{
        dd('errors');
    }
    }
    
  • I fill in my login with incorrect details & I get the dd() output as expected.

  • I return to my login form.

  • I enter valid user details.

  • I get the following permissions error:

    file_put_contents(/var/www/laravel/app/storage/sessions/62da397f3ec526dea6cabf36f06657234dfb9de7): failed to open stream: Permission denied
    
  • In terminal I run sudo chmod -R app/storage again.

  • I can reload the page and the permissions denied error is gone.

I've done this consistently every. single. time. I can't work out what's messing with my permissions or how to fix it.

  • 写回答

2条回答 默认 最新

  • douzhun8615 2014-08-06 03:40
    关注

    I've just figured it out. it's to do with the vagrantfile. I added the owner and group info to the synced files and it's working now.

      config.vm.synced_folder ".", "/var/www", :owner => 'www-data', :group => 'www-data'
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器