Flourish PHP Unframework
This is an archived copy of the forum for reference purposes

Sessions not working in Chrome

posted by alantyson 7 years ago

Hi there,

I'm trying to setup a basic login system: The setup is:

/index.php protected with a call to fAuthorization::requireLoggedIn('Administrator')

/auth/login.php the login form, which calls /auth/loginverify.php

/auth/loginverify.php checks for credentials against database, sets the authLevel, calls fSession::enablePersistence and sets some session variables, then calls URL::redirect(fAuthorization::getRequestedURL(TRUE, '/index.php'))

This setup works fine in Firefox and Safari; however in Chrome, after loginverify.php redirects to index.php, all of the session variables are empty so it redirects back to login.php again. I can't figure out what is going on, why the session variables can be read after login in index.php in Firefox and Safar but in Chrome they appear blank. I've even deleted all cookies in reset both browsers and same results.

Many thanks

PROBLEM SOLVED

Spent a whole day on this one and finally found this page: https://secure.kitserve.org.uk/content/php-session-cookie-problems-google-chrome-and-internet-explorer

From the site: When testing a local site in Chromium, you must either access it via IP address (e.g. 127.0.0.1) or set the cookie domain parameter to the empty string.

posted by alantyson 7 years ago

I experienced a similar issue, and thought I would leave my experiences here in case any random googlers run across this page. If you ever experience issues with Chrome dropping your session, logging you out, etc, make sure you have a valid favicon.ico being served. After a day or two if constant authorization issues I discovered that Chrome was starting a new session when the favicon.ico request came back as a 404. Adding the favicon file stopped Chrome from dropping my session.

This was particularly frustrating as Chrome doesn't create a console log line for missing favicon files, it just fails silently.

posted by titusjohnson 7 years ago