Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Session/cookie error when having multiple instance of Laravel in the same domain

Tags:

php

laravel

Hello i started using Laravel framework for my Facebook apps lateley and i created a basic app that i copy for every new project and start modifying from there. First thing i do is i change couple of letters in the application key inside config/application.php file.

Now if i develop 2 apps at the same time and keep switching between them i run into some sort of cache/cookie errors that block my app from displaying. I can get rid of them by deleting cookies that are related to my domain where i store the apps but as i understand same thing might happen to a user who happens to visit both my apps.

How could i make it work right?

here's the error i get:

Unhandled Exception

Message:

unserialize() [function.unserialize]: Error at offset 0 of 704 bytes
Location:

/mydomainpath/myapp/laravel/session/drivers/cookie.php on line 24
Stack Trace:

#0 /mydomainpath/myapp/laravel/laravel.php(40): Laravel\Error::native(8, 'unserialize() [...', '/data01/virt319...', 24)
#1 [internal function]: Laravel\{closure}(8, 'unserialize() [...', '/data01/virt319...', 24, Array)
#2 /mydomainpath/myapp/laravel/session/drivers/cookie.php(24): unserialize('??1?:????9O??.?...')
#3 /mydomainpath/myapp/laravel/session/payload.php(52): Laravel\Session\Drivers\Cookie->load('oBACwMEgwF2YXeZ...')
#4 /mydomainpath/myapp/laravel/session.php(35): Laravel\Session\Payload->load('oBACwMEgwF2YXeZ...')
#5 /mydomainpath/myapp/application/start.php(172): Laravel\Session::load()
#6 /mydomainpath/myapp/laravel/bundle.php(102): require('/data01/virt319...')
#7 /mydomainpath/myapp/laravel/laravel.php(76): Laravel\Bundle::start('application')
#8 /mydomainpath/myapp/public/index.php(34): require('/data01/virt319...')
#9 {main}
like image 339
Nick Avatar asked Nov 05 '12 13:11

Nick


1 Answers

Your cookie settings should differ in your projects. If they don't that may be a reason why it gets overwritten.

Check you application/config/session.php file.

like image 145
noherczeg Avatar answered Nov 11 '22 11:11

noherczeg