Laravel application reading from non-existent session file

Viewed 49

For the past few months I've been working on a web application using Laravel. Everything works perfectly on my local computer using wampserver. However, I need to upload this code to a live server. When I go to sign in on the live server, it gives me a TokenMismatchException in VerifyCsrfToken.php (line 68). I know this is a common error, and that the most likely cause is not including {{ csrf_field() }} in the form element, but I checked and the form already has it.

Are there any other reasons that this error could have occured?

Here is the form:

<?php echo Form::open(array('url' => url('signin'), 'method' => 'post', 'name' => 'form')); ?>
<input type="hidden" name="_token" value="{{ csrf_token() }}"/>
<div class="form-group <?php echo e($errors->has('email') ? 'has-error' : ''); ?>">
      <?php echo Form::label(trans('auth.email')); ?> :
      <span><?php echo e($errors->first('email', ':message')); ?></span>
      <?php echo Form::email('email', null, array('class' => 'form-control', 'required'=>'required', 'placeholder'=>'E-mail' )); ?>

</div>
<div class="form-group <?php echo e($errors->has('password') ? 'has-error' : ''); ?>">
      <?php echo Form::label(trans('auth.password')); ?> :
      <span><?php echo e($errors->first('password', ':message')); ?></span>
      <?php echo Form::password('password', array('class' => 'form-control', 'required'=>'required', 'placeholder'=>'Password')); ?>

 </div>
 <div class="form-group">
    <label>
        <input type="checkbox" id="remember" value="remember" name="remember">
        <i class="primary"></i> <?php echo e(trans('auth.keep_login')); ?>
    </label>
</div>
<input type="submit" class="btn btn-primary btn-block" value="<?php echo e(trans('auth.login')); ?>"></input>
<?php echo Form::close(); ?>

Edit:

After looking at the files more, I found that the error is because Laravel is not reading from the correct session file, and it is attempting to read from a session file that does not exist. As a result, the tokens do not match up and I that is why I am getting the TokenMismatchException. I still do not know how to fix this.

0 Answers
Related