currently using :
laravel 5.3
session driver already tried memcached,redis
my session data each refresh page it's always gone..
when i try using php artisan serve, it's normal not gone at all.. but when accessing from LAN.. it's look like no even stored at all..
i try using virtual host on my fedora but it's normal..
just because of accessing from LAN why my session can't stored at all?
is somebody experience something like this?
just scare if i up this app.. and this problem show up..
here's part of my login controler that stored email and token
$req->session()->put('USER_TOKEN',$data->token);
$req->session()->put('USER_EMAIL',$result->param["email"]);
for get the session value in my home controoler
$req->session()->get('USER_TOKEN');
$req->session()->get('USER_EMAIL');
best regards,
Related
I've made a new installation of Voyager on XAMPP on Windows following the instructions at https://github.com/the-control-group/voyager
I forgot to install with dummy data so I added an admin user using php artisan voyager:admin me#mydomain.com --create however when I try to login I get the 419 | Page Expired error which I understand is usually an issue with Laravel sessions.
My versions are: Voyager v1.4 | Laravel v7.18 | PHP v7.3.2 | MySql v5.0.12
The following points maybe relevant:
If I look at the login page source code I don't see any reference to a csrf field.
Looking in the database the user exists in the user table, and I entered an email_verified_at date directly.
I notice there's no entry in the user_roles table. I don't know what minimum database entries are required to make it work.
I've checked that session files are being created in storage/framework/sessions/
There's no error log in storage/logs/
I set 'debug' => env('APP_DEBUG', true), in config/app.php (APP_DEBUG was already set to true in .env) and retried the login but not found any debug log file.
I'm new to Voyager and still learning Laravel. Any ideas please how to make it work please?
UPDATE:
After several refreshes of the login page I was able to login, but if I click any menu link it returns me to the login page.
UPDATE2:
Re-running the install with dummy data succeeded but it didn't alter the login session issue. However it works perfectly on another device, so it must be some kind of browser session issue particular to the one PC.
Incidentally running the install with dummy data did not add any entries in the user_roles table, but the admin role is assigned when viewed in the users screen (on my other device).
I was getting this same error, i was serving my app on 127.0.0.1:8000 and my SESSION_DOMAIN was set on localhost. Make Sure you SESSION_DOMAIN in your env is set to the actual domain the app is being served on. Theissue was fixed by running php artisan serve --port=80 and browing to localhost/admin to login
I move the project from shared hosting to VPS hosting now everything working fine such as inner pages, design, image loading but I am unable to login and signup now.
When I submit the login/Signup form it will redirect to the same page but without any error message.
And I also generate the Token via command do I need to do anything more to make it work.
I also check the laravel.log file and other things but unable to solve this.
Can anybody face the same issue
Issue is I do not create the session folder to store the session of Laravel 5.4
My Laravel 5.6 project was working well.
But suddenly when I try to login sometimes it says
The page has expired due to inactivity.
and sometimes it login properly with out any error. For example
I go to page 127.0.0.1:8000/login...submit login form and get that error.
I refresh the 127.0.0.1:8000/login page...submit...again error.
I refresh the 127.0.0.1:8000/login page...submit and it works properly :|
Anybody know whats wrong with my project?!
this project works on my host without any problem and I have {{ csrf_field }} in my form.
I've tried to clear cache, view, route, config and deleting browser cache/cookie
and change SESSION_DRIVER=array but still got error.
UPDATE :
another thing that i should say is when it work properly and i login to the panel...when i submit any forms i got out of the panel and i should login again.
for localhost development open kernel.php inside Http folder and just comment this line :
\App\Http\Middleware\VerifyCsrfToken::class,
the csrf protection of laravel doesn't work properly on localhost. I already tried everything. just comment that, it's very annoying problem.
finaly...after 3 bad days focus on this issue...i find the answer and i hope it help someone else :
check your browser setting -> cookies and see how many cookies create
when a user login.
by default laravel create 2 cookies when user login with names :
"XSRF-TOKEN"
"laravel_session"
these are ok but other cookies which you create manually or other installed packages creates cause this problem.
i was using eloquent-viewable package and it creates a cookie everytime i logged in.
i remove this package and then everything works properly :)
I am working on the Laravel project 5.3 and the problem I am facing is when I log in to frontend or the admin Panel another session destroy and logouts the application, need some solution. Both are running on different ports like
example.com
example.com:75/public
example.com:81/public
I am extremely sorry for the bad English and thank you in advance.
User session is stored in the browser cookie, and cookie is related to website domain name. So in your case looks like you use one cookie file for two websites (because it use same name). You can configure virtual host to solve this.
I just changed my .env configuration:
CACHE_DRIVER=file
CACHE_PREFIX=*with_different_name*
SESSION_DRIVER=file
SESSION_COOKIE=*with_different_name_session*
change chache_prefix and session_cookie with different name between your project
it worked for me.
You can connect one of them something like project.local and connect the other with localhost:8000
Just search laravel vhost(virtual host). Thats easy. Good Luck.
I have a CakePHP website with its own login system using the Auth component. I would like to know if the following is possible:
A user has logged in and is navigating the website. At one point, he can click a link that opens an external php file. With external I mean that it could be in another folder of the same server, but outside the CakePHP app folders.
The "tricky" thing (for me) is to only show the contents of that php file if the user is logged in (to prevent someone without an account accessing those contents). I can't use Auth there because I'm "outside" Cake... I don't know if maybe using $_SESSION, but I don't know how...
Is this even possible? And yes, the php has to be outside the CakePHP app folder system.
Any ideas?
I'll add you also need to set session name to "CAKEPHP" using
session_name('CAKEPHP')
just before your external app session_start() otherwise you could not apply Kashif Khan suggested solution :)
Cheers,
Yes you can access the cakephp SESSION outside cakephp folder. try this session variable
$_SESSION['Auth']
if it exists then check for user here
$_SESSION['Auth']['User']
This is not working in Cakephp3. After calling
session_name("CAKEPHP");
session_start();
Application session is expiring.