会话文件laravel 5.1.7不可写

My Session files are not writable

I make chmod -R 777 storage/framework/sessions but per each request be create a session file.

I using a 1&1 shared server with PHP 5.5.26

app.blade.php

<?php
    $encrypter = app('Illuminate\Encryption\Encrypter');
    $encrypted_token = $encrypter->encrypt(csrf_token());
?>
<meta name="csrf-token" content="{{<?php echo $encrypted_token ?>}}">

main.js

 $.ajaxSetup({
        headers: { 'X-CSRF-TOKEN' : $('meta[name=csrf-token]').attr('content') }
    });

login.blade.php

@section('loginForm')
{!! Form::open(['route'=>'login', 'role' => 'form', 'name' => 'loginForm', 'id'=>'loginForm', 'data-toggle' => 'validator', 'class' => 'form-horizontal' ]) !!}
<div class="form-group has-feedback">
    <label for="email" class="col-sm-2 control-label hidepola">Email</label>
    <div class="col-sm-10">
        <input class="form-control" data-error="El correo de seguir esta forma ejemplo.correo@dominio.com" pattern="^[_a-z0-9]+(\.[_a-z0-9]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$" type="email" name="email" placeholder="Correo" required>
        <div class="help-block with-errors" ></div>
    </div>
</div>
<div class="form-group has-feedback">
    <label for="password" class="col-sm-2 control-label hidepola">Contraseña</label>
    <div class="col-sm-10">
      <input data-minlength-error="Minimo son 6 caracteres" data-minlength="6" maxlength="16" class="form-control" type="password" name="password" placeholder="Contraseña" required>
      <div class="help-block with-errors"></div>
    </div>
</div>
<div class="form-group">
    <div class="col-sm-offset-2 col-sm-10 col-xs-12">
      <div class="checkbox" id="ingresa">
        <label>
          <input type="checkbox"> Recordarme
          <a href="{{ URL::route('recoverView') }}">¿Olvidaste tu Contraseña?</a>
        </label>
      </div>
    </div>
</div>
<div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
      {!! Form::submit('Iniciar Sesion',['class' => 'btn btn-primary']) !!}
    </div>
</div>
{!! Form::close() !!}

@stop

AuthController

if (Auth::attempt(['email' => $data['email'], 'password' => $data['password'], 'is_active' => 1],$request->has('remember'))) {

            return response()->json([
                'success' => [
                    'message' => 'Login User'
                ]
            ], 200);

        }

My repo is here Thanks a lot

In remote server cleanup session folder and then give 777 permission to folder.

But I recommend You to change session driver to:

  1. APC ('driver' => 'apc')

    or

  2. COOKIE ('driver' => 'cookie')

in config/session.php file
and enable encryption ('encrypt' => true) when using COOKIE driver

we know that session id stored in cookie, so why not to keep whole session data in cookie and encrypt it?

I save my layout.blade.file to UTF8 without BOM with Notepad ++

I use sesion driver file.

I use this link.