I want transfer magento session storage from database to files.
I want to know how to do this.
What i did is, download [BLOB - 3.6 KiB] file from database core_session table for session and rename it with sess_frontend_session_id like sess_n7g9t1872co23p0btnbos921c4
and then upload file to var/session but it's not working
Cart data is lost for not logged in customers.
- 
 Having same issueVaibhav Ahalpara– Vaibhav Ahalpara2017年07月25日 05:57:17 +00:00Commented Jul 25, 2017 at 5:57
1 Answer 1
Finally find the solution to transfer session data from database to files
You can run following script to transfer session data from database to files
<?php
ini_set('memory_limit', '500M');
ini_set('max_execution_time', 0);
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', 1);
require_once 'app/Mage.php';
umask(0);
Mage::app();
 $resource = Mage::getSingleton('core/resource');
 $readConnection = $resource->getConnection('core_read');
 $table = $resource->getTableName('core/session');
 $query = 'SELECT * FROM ' . $table;
 $session = $readConnection->fetchAll($query);
 $filePath = 'var/session/';
 foreach ($session as $sess) {
 $file = $filePath.'sess_'.$sess['session_id'];
 $fp = fopen($file, 'w');
 fwrite($fp, $sess['session_data']);
 fclose($fp);
 chmod($file, 0777);
 }
?>
Explore related questions
See similar questions with these tags.