Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

failed to write session data magento

I'm trying to install Magento 1.8 on my PC. I'm using Vagrant as a VM with a Debian environment. Everytime I try installing it I have an error displayed :

Fatal error: Uncaught exception 'Exception' with message 'Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/www/html/magento/magento_1.8/var/session) in Unknown on line 0' in /var/www/html/magento/magento_1.8/app/code/core/Mage/Core/functions.php:245

And I can't find out why ! The path is correct and so are the access rights to that folder. Anyone instpired ?? Thanks !! :)

like image 835
Matheus Avatar asked Sep 30 '14 14:09

Matheus


2 Answers

I had the same issue with vagrant, I fixed it by changing the session.save_path to place it in the VM.

Change the file app/etc/local.xml

<config>
    <global>
        ...
        <session_save><![CDATA[files]]></session_save>
        <session_save_path>
            <![CDATA[/tmp/session]]>
        </session_save_path>
     </global>
     ...
</config>

Clear your cache and restart apache if you have a php accelerator:

sudo rm -R var/cache/* var/session/*
sudo rm -R var/session
sudo service apache2 restart

Hope this help.

like image 106
lenybernard Avatar answered Oct 17 '22 20:10

lenybernard


I also had the issue in vagrant and I can't really tell you, what is going wrong there.

First I thought it could be a memory issue, so I have increased memory to 128Mb just in case. Didn't work.

My case was it always showed up few times, but then it suddenly worked. Until I have restarted memcache.

So rather then restarting it I started to flushing it via bash script, and problem are gone. To get you inspired here it is:

#!/bin/bash
if [ ! -f "app/etc/local.xml" ]; then
    echo "Not in a magento root, aborting"
    exit 1;
fi
vagrant ssh -c '(sleep 0.2; echo flush_all; sleep 0.2; echo quit; ) | telnet 127.0.0.1 11211'

rm -rfv var/cache
rm -rfv var/full_page_cache

exit 0;
like image 1
David Rosa Avatar answered Oct 17 '22 19:10

David Rosa