Showing posts with label session. Show all posts
Showing posts with label session. Show all posts

Thursday 27 December 2018

No space left on device in server | PHPMysql not connect session | Full Inodes 100% | Check CPU Process and MEMORY

Issues
  1. open(/var/lib/php/sessions/sess_, O_RDWR) failed: No space left on device (28)
  2. PHPMysql not connect
  3. Database not connect
Solusions

Check CPU and MEMORY usage of server from terminal
ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%cpu | head
df -h
Check file size
find /home/ -size +100M 

 

 Check INODES in server (Inode mean total files into server)
df -i
Search INODES from system and perticular folder (Get number of file in perticular directory)
for i in /var/www/html/*; do echo $i; find $i |wc -l; done
Check INODES into specific directory
ls -l /var/lib/php/sessions | wc -l
Remove all files from specific directory
rm -r /var/lib/php/sessions/ 
If you are using PHP so you can create code in any existing file
$path = '/var/lib/php/sessions/';
$dir = opendir($path);
$i = 0;
while ($dir && ($file = readdir($dir)) !== false) {
    unlink($path.$file);
    echo $i.' - '.$path.$file.'<br>';
    if($i == 50000){
        exit;
    }
    $i++;
}

Monday 20 July 2015

How to Set, Retrieve and Unset Session Variables in Magento

Set session Data


$session = Mage::getSingleton("core/session", array("name"=>"frontend"));

$session->setData("day_filter", 'weeks');
$session->setData("days", '5');          
$session->setData("next_delivery_date", '2012-05-12');
 
or
 
Mage::getSingleton('core/session')->setIsSalesrepTax('test'); 
 

UnSet session Data

 
$session->unsetData('day_filter');
$session->unsetData('days');
$session->unsetData('next_delivery_date'); 
$session->unsetData('IsSalesrepTax');  

Session Data Set to null

$session->setData('day_filter', NULL);
$session->setData('days', NULL);
$session->setData('next_delivery_date', NULL); 
 
 

Magento Set, Retrieve and Unset Session Variables

 To set a Magento session variable:

$myValue = 'My session';
Mage::getSingleton('core/session')->setMyValue($myValue);
 

To Retrieve:

$myValue=Mage::getSingleton('core/session')->getMyValue();

To Unset:

Mage::getSingleton('core/session')->unsMyValue();