95
votes
Accepted
Magento 2 backend session timeout
Stores > Settings > Configuration > Advanced > Admin > Security > Admin
Session Lifetime (seconds)
Also, there is a possibility to set this parameter directly to the database, just put a value ...
55
votes
"invalid form key. please refresh the page" - cannot login to admin panel
It also happens if the cookie domain in System > Configuration > Web > Cookies is different from the actual site domain.
To remove the setting without access to the admin panel:
use the following ...
38
votes
SOLVED - Magento 2 - Unable to login to admin (no error message) stuck at login screen
Emergency Fix
Whether or not this solution works, please try these steps first. You WILL be able to login which means you are on the right page. If you still could not login, your issue is most ...
34
votes
Magento 2 - How to get all items in cart?
I'll answer the question in two parts:
I. Where should you change the checkout URL?
The destination in link.phtml is $block->getCheckoutUrl(). You should not change the template to change ...
29
votes
Magento 2 - How to get all items in cart?
The use of Magento\Checkout\Model\Cart is deprecated.
You should use the session to get the quote and your cart items.
use Magento\Checkout\Model\Session;
public function __construct(
...
...
27
votes
Accepted
Session validation failure in Magento 1 EE v 1.14.3.x (and CE 1.9.3.x)
After some advanced debugging, session tracing and thinking about all that magic I was able to reproduce the problem and understand the reason for it. I prepared a little timing illustration, you can ...
26
votes
Accepted
How to remove SID (session ID) from URL in Magento 2
Go to the Store > Configuration > General > Web > Session Validation Settings > Use SID on Storefront and set its value to No
Here is the good answer about the SID:
The SID is a "session ID". ...
25
votes
Accepted
Understanding Magento Registry
The registry stores data to memory which is specific to that request (rather than user or anything else), and persists for the duration of that request only. The principle is very simple really, the ...
23
votes
Accepted
Magento 2: Where is cart data saved?
Magento2, save cart details at Quote tables.
For Cart general details use quote table .
Carts item details at quote_item.
Cart items option details at quote_item_option
Additional:
Checkout ...
22
votes
Accepted
customer session does not work except customer page - Magento 2
To have access to real data in Magento 2 session you have to apply one of the following
Do it on non-cacheable page.
Disable full page cache.
Set $this->$_isScopePrivate = true for block where ...
20
votes
Accepted
What's the correct cookie config for a Magento site split across multiple instances as subdomains?
We had to do something similar recently:
Cookie Path: /
Cookie Domain: .site.com
That did the trick in our case.
20
votes
Magento 2 backend session timeout
Check attached image screenshot for better understanding of admin process.
Go to Stores->Settings->Configuration->Advanced->Admin->Security->Admin Session Lifetime (seconds)
And check screenshot.
19
votes
Accepted
"invalid form key. please refresh the page" - cannot login to admin panel
I am posting the question / answer because I couldn't find anything relevant.
The issue was that the drive on which my magento installation resides was full. I freed up some room, clear the /var/...
18
votes
Magento 2 - How to get all items in cart?
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$cart = $objectManager->get('\Magento\Checkout\Model\Cart');
// retrieve quote items collection
$itemsCollection = $cart->...
16
votes
Accepted
Magento 2.1 admin logged in issue in session
To disable this feature go to
Stores > Configuration > Advance > Admin > Security
and
change value of Admin Account Sharing to Yes.
15
votes
Magento 2: Syncing Backend and Frontend State/Cache
Magento 2 uses Customer Data JS API to represent user session data in browser. All JS widgets are supposed to retrieve customer data from Customer Data JS API. Customer Data is split to sections (cart,...
14
votes
Accepted
When does Magento use sessions and when cookies?
No, that means that sessions are persisted with a cookie, which contains the ID of the session. The only alternative in PHP is a URL parameter like ?SID=d41d8cd98f00b204e9800998ecf8427e where ...
12
votes
Accepted
Magento session storage: Redis vs. Memcached
As per as my concept Redis is most good:
Memcached is Free & open source, in-memory key-value store, high-performance, distributed memory object caching system.
Redis is an open-source, ...
12
votes
Accepted
No Inode space!; How to delete Magento sessions folder's contents?
I wouldn't delete all sessions, start with the older ones first. Since the quote is valid for 30 days you could try going with that. In your var/session folder.
find . -mtime +30 -exec rm {} \;
This ...
12
votes
Magento 2 backend session timeout
Solution for Magento 2.1+
Since Magento 2.1 the admin session lifetime is always "session", i.e. until the browser is closed. This has been might have been introduced for security reasons.
The ...
12
votes
Accepted
Web Crawler creates a lot of sessions
BOT & SESSION
I'm not sure Bot needs sessions and the answer may be different for every bot for sure they don't store a cookie so it is no possible to re-use the old session matching the session ...
12
votes
Accepted
Get current order ID magento 2
below code will give you last order id
protected $_checkoutSession;
public function __construct(
.....
\Magento\Checkout\Model\Session $checkoutSession,
.....
) {
$this->...
11
votes
Accepted
How to empty cart or clear session "externally"
This one should work as it removes all items from the current quote:
Mage::getSingleton('checkout/cart')->truncate();
But you need to save it afterwards:
Mage::getSingleton('checkout/cart')->...
11
votes
Accepted
What should I choose Session Save - 'Files' or 'DB' while magento install?
This is explained pretty nice in the Magento Devdocs (actually the functionality is the same as in Magento 1):
In the Session Storage Options section, click one of the following
options:
File to ...
11
votes
Session validation failure in Magento 1 EE v 1.14.3.x (and CE 1.9.3.x)
6. It is programming - be creative ;)
Another way to fix this (and improve session validation)
ColinM @ https://github.com/OpenMage/magento-lts
The session code currently stores the session ...
11
votes
Magento2.2 - - Failed to read session data
Adding an answer for posterity as this was already correctly resolved in the comments by Anthony.
When using Redis to store the session data, the Warning: session_start(): Failed to read session data ...
10
votes
Accepted
How to stay logged into Magento 2.0 longer
Go to Stores > Config > Advanced > Admin > Security and edit the Admin Session Lifetime field. This is in seconds, for development purposes I usually go for 28800 which is 8 hours.
10
votes
Login and redirect customer to his website
First,you need to do some changes in setting.
Share customer accounts between multiple Website
You should configure this feature here: System -> Configuration -> Customer Configuration -> ...
9
votes
unable to get customer data from session in custom module?
You need to check customer is loggedin or not.
Without customer loggin,you cannot get customer data from session:
if (Mage::getSingleton('customer/session')->isLoggedIn()):
$customer = Mage::...
9
votes
Accepted
keeping customers logged in after deleting var/session in magento
No. The sessions are what keeps your customers logged in. But deleting all the sessions can't be the solution to whatever problem you face. Either it's enough to delete cookies to loose your own ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
session × 630magento2 × 204
magento-1.9 × 119
cookie × 76
customer × 55
cart × 51
customer-session × 50
admin × 45
login × 39
checkout × 37
magento-1.7 × 32
php × 31
magento-2.1 × 24
cache × 24
magento-1.8 × 23
magento-1 × 18
redis × 16
event-observer × 15
core-session × 15
quote × 14
api × 13
url × 13
messages × 13
memcached × 13
magento2.3 × 12