当前位置: 动力学知识库 > 问答 > 编程问答 >

Laravel on Vagrant and Windows TokenMismatchException, possible related to directory permissions

问题描述:

I keep getting a TokenMismatchException when working on a cloned project using Vagrant on Windows.

I have several other laravel projects using similar setups and they work fine.

I tried cloning this project on a VM using VirtualBox and it works, I also cloned this project on a temporary remote staging server and it works but it does not using Vagrant on Windows.

I commented out the

Route::filter('csrf', function()

{

if (Session::getToken() != Input::get('csrf_token') && Session::getToken() != Input::get('_token'))

{

throw new Illuminate\Session\TokenMismatchException;

}

});

but unfortunately I cannot login afterwards as it just returns me to the index page.

I also changed the app/storage permission to 777 recursively as I believe that the token issue is within a session file which is not being overwritten. I also deleted all the content of app/storage/sessions and i can see new files generated when I refresh the application.

I would really like to be able to work using vagrant on this project as it requires regular and speedy changes and also because this is the setup I use on all projects. As I said all other Laravel projects work fine even the ones which I started off using VirtualBox and now on Vagrant.

All help is appreciated. Please let em know if my question isn't clear enough.

Thanks

网友答案:

As my question says, the issue was due to directory permissions. Because the original project was developed on a windows system not using Vagrant nor VirtualBox the permissions could not be changed through vagrant.

I solved this by starting a new laravel application and copying my controllers, models, config files and assets.

Now I can use Vagrant to manage this project.

分享给朋友:
您可能感兴趣的文章:
随机阅读: