My last post explained how I had forgot my password, and had to fix email functionality for Magento on my vagrant box. It turns out I did NOT forget my password, but I used XDebug and discovered that the real problem was:

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

The reason for this seemed to be permissions, so I chmodded it by editing the vagrant file (thats how you set them when its a shared mount). However for some odd reason (possibly to do with the way PHP does sessions), the session_files were being created but were all 0 bytes in size!

I decided that probably the easiest solution (I tried all the others and they failed! (other than switching to db session storage, I wanted it fixed and to understand!)) would be to save the session data outwith the mounted shared folder (ie outside the site’s root) and instead from /tmp/session.

To do this, in your Magento project, open app/etc/local.xml. You’ll see a line like this:

<session_save><![CDATA[files]]></session_save>

to change to db storage, change the word files to db. However, to change the ession path, we add another field just below it:

<session_save_path><![CDATA[/tmp/session]]></session_save_path

Now that’s done, delete the contents of var/session and var/cache. You should now be able to login! Thank god for that!

 

Advertisements