1

Suddenly the session on our live site stopped working. Do not know why this is happening.

Our site is hosted on AWS EC2 Linux

var and var/session folder exists and have permission 777

nothing there in exception.log or system.log

cache folder is cleared and have permission 777

Cannot login as customer, admin and add to cart not working

  • php error logs? disk space? cached/wrong form_key? cookie value and session are the same? – user2857 Mar 8 '15 at 15:54
  • for more information, try stackoverflow.com/a/7474767/2375207 – nicolallias Jun 25 '15 at 8:12
  • if you clear out your var/session directory do new session files get created when you try to log in? – Andrew Kett Jun 25 '15 at 8:54
2

If you are using Google Chrome, you can right-click on the page, choose Inspect Element, then Resources tab, look for Cookies down the left-hand menu, and click on your domain name.

Under the domain name, the cookies that have been set for it will be displayed, along with path, expiry, etc. Very useful.

In your case, you are looking for the 'frontend' session cookie under 'name'. You can delete it, and refresh the page to see if Magento recreates it, in which case sessions are probs working. Hope that helps :)

PS: Magento uses sessions very heavily, if they're broken other things will be breaking all over the show as well.

Also follow bellow links

https://stackoverflow.com/questions/9891761/magento-customer-session-not-working

https://community.magento.com/t5/Programming-Questions/Magento-1-9-customer-and-cart-session-not-working/td-p/3540

I hope this will help you.

| improve this answer | |
  • Good suggestions. Determine if sessions sre actually working, and that values are just not retained / or that a new sedsion is constantly created. This may be of interest: magento.stackexchange.com/questions/385/… – ProxiBlue Dec 25 '15 at 11:03
  • if you are happy with answer than give +1 or accept answer and any help needed comment here. i am here. – Denish Vachhani Dec 25 '15 at 11:07
2

This can happen when your disk runs out of available inodes. Debian based systems change the way that PHP sessions are garbage collected. With the default settings for PHP session garbage collection, Magento file based sessions won't be cleaned up. This can lead to a very large number of session files, which if left unchecked, can overrun the available inodes on the disk. The disk will have available space, but is unable to create new files.

Use df -i to check the number of inodes in use.

| improve this answer | |
1

It happened to me as well and I fixed this by changing the /var/ folder permission to 777 instead of 755.

Hope this will help someone.

| improve this answer | |
0

In regards to the Magento session issues, no one mentions the cookies could be incorrectly setup in the DB. We wasted a morning on this after we imported a DB update that had the wrong cookie domain.

Make sure your core_config_data table has the right setting for this path value:

web/cookie/cookie_domain

The domain should match what you have in the URL.

https://www.myawesomemagentosite.com

web/cookie/cookie_domain = .myawesomemagentosite.com
| improve this answer | |
-1

In your index.phpthere is an included file that somehow might be starting another session – therefore telling Magento not to bother (not to bother calling session_start()) – this leads to the website displaying correctly, but no ability to add products to cart or login to the admin – nor any error message!

To fix this all you have to do is to add the following line to index.php below where you were including some custom file and above where Magento was being called.

require_once('some/dodgy/session/starting/file.php'); unset($_SESSION);

| improve this answer | |
  • We did not include any custom file. Also, I added unset($_SESSION) just before this line: $mageFilename = MAGENTO_ROOT . '/app/Mage.php'; but no luck. I cleared cache and permissions are 777 :( – Ashutosh Pandey Mar 8 '15 at 19:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.