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

laravolt's avatar

Database Session Driver Issues

I have multiple replicas, that contact a single master with a database over a private network.

I have setup the replicas to use the database session driver and created the appropriate session table.

When I attempt to login, I can see entries being created in the session table (though the IP being the private network range), a XXX_session cookie is also created, but the user is never logged in and gets thrown back to login.

What's wrong, is it because laravel writes the private IP instead of the real users IP into the database? if so how do I enforce it to write the real IP and if it's not what else could it be?

0 likes
4 replies
mlewis's avatar
mlewis
Best Answer
Level 10

One possibility is if you've changed the id record on the users table to be uuids (string) instead of int, then you'll need to change your sessions table migration to reflect that on the user_id column. Encountered this the other day myself.

2 likes
laravolt's avatar

@mlewis oh, indeed my users table has the id as "uuid" not string though. I'll check the sessions table in a bit, that might be actually it, thank you so much!

Please or to participate in this conversation.