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条)

报告相同问题?

悬赏问题

  • ¥20 我要一个分身加定位两个功能的安卓app
  • ¥15 基于FOC驱动器,如何实现卡丁车下坡无阻力的遛坡的效果
  • ¥15 IAR程序莫名变量多重定义
  • ¥15 (标签-UDP|关键词-client)
  • ¥15 关于库卡officelite无法与虚拟机通讯的问题
  • ¥15 目标检测项目无法读取视频
  • ¥15 GEO datasets中基因芯片数据仅仅提供了normalized signal如何进行差异分析
  • ¥100 求采集电商背景音乐的方法
  • ¥15 数学建模竞赛求指导帮助
  • ¥15 STM32控制MAX7219问题求解答