Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

v1234's avatar

Laravel Session issue , generating multiple session every minute can not read right session on godaddy VPS

i started this Thread previously but no success yet so here i'm

http://stackoverflow.com/questions/32761401/laravel-session-issue-generating-multiple-session-every-minute-can-not-read-ri

History of problem: I have one website developed in laravel 4.2 and eariler it was hosted on godaddy shared hosting (linux /deluxe plan).There it was working good no problem just small issues with session and i chnaged my php version all become smooth.

before 1 month we switched to VPS and we started facing many different problems. we solved out some but now from past 2 weeks i'm facing this strange issue with session.

The problem is my Laravel 4.2 application creating multiple session every minute. and can't read the right one.i can authenticate user and log in successfully but can not read right session info although it creates different 4-6 session every minute.

i surfed internet for every possible thing that can cause this kind of behaviour in laravel App but couldn't find any help. i checked most of the link on stackoverflow.com and laracast.com in their fourm and finally i'm here.

The problems are:

my laravel app generating multiple session with different id's and different '_token'.

it also generate the right session with all the values in it but can not read it on next page after getting redirect. so session::get('xyz') gives 'null' as output that cause error in my app if it null.

on localhost (xampp /windows 7 environment) there is only one session per user but here i'm getting at least 2 session on each request and it keep generating multiple sessions(4-6) every minute.**

please guide me why it is happening any smallest help would be appreciated and let me know if any other information u want to analyse this problem...thanks

what i did till now:

tried with different driver 'file' driver, 'native' and 'database' driver....but no luck. Even with database drive it create multiple session in table after successfully authentication of user (at least 2-3 at a time )

checked with different browser (Firefox and chrome).

**At first I thought session is not getting create so it can not read but I found there is one session already with values and others are getting create one after one with no values except _token and some other field ( laravel's internal). But it is not reading right session file..I don't know if it is reading session at all.

I checked my directory for read/write permissions all are set for good...my biggest concern is why it creating multiple session every minute...it should not happend by default.

i created route to set session as my_domain.com/test/laravel_session_put

and another route to get the session value my_domain.com/test/laravel_session_get

.still no luck. i'm not able to receive session values on get route.

one thing i noticed as i'm creating session only if a user is logged in but here whenever i visit any url on my domain it creates blank session automatically...... like it should not create session if i'm visiting my_domain.com (without loggin in) ....but it is creating multiple session that keep generating every few seconds.

0 likes
3 replies
Corez64's avatar

Have you checked what the cookies are being set as? The cookies might be being set with the wrong domain name, or you might be forcing the cookies to only work over HTTPS and your only using HTTP.

v1234's avatar

i have no idea how to check if i'm mistakenly forcing them to work over HTTPS or HTTP. plz guide me how to check if session being set with wrong domain name.

Please or to participate in this conversation.