Skip to content

Sessions Configuration

NOTE: All Magento stores are required to use either Redis or Memcache (recommended) for session storage. We do not allow sessions to be stored in files nor in the database. See Magento Requirements for the full list of requirements.

The memcache service is enabled by default on Mojo Stratus.

Memcache

Magento 1

Edit your session block in local.xml to enable Memcache sessions on your Magento 1 store. ( PHP 5.6 )

<session_save><![CDATA[memcache]]></session_save>
<session_save_path><![CDATA[tcp://memcache:11211?persistent=0&weight=2&timeout=60&retry_interval=10]]></session_save_path>

If you are using PHP 7.0 or higher with Magento 1, please use the following instead.

<session_save><![CDATA[memcached]]></session_save>
<session_save_path><![CDATA[memcache:11211?persistent=0&weight=2&timeout=60&retry_interval=10]]></session_save_path>

Magento2

Edit your session block in env.php to enable Memcache sessions on your Magento 2 store.

'session' =>
   array (
      'save' => 'memcache',
      'save_path' => 'tcp://memcache:11211'
),

For Magento version 2.3+, add the following under PHP -> OPTIONS

session.save_handler=memcache
session.save_path=memcache:11211

 

Redis

Magento 1

Edit your session block in local.xml to enable Redis sessions on your Magento 1 store. Note: In order to use Redis for sessions you must enable the Cm_RedisSession module by opening app/etc/modules/Cm_RedisSession.xml and changing false to true Please note, if this file does not exist you MUST install the module otherwise Redis will not function for sessions on your store.

<session_save>db</session_save>
<redis_session>                     
<host>redis</host>          
<port>6379</port>
<password></password>          
<timeout>2.5</timeout>         
<persistent></persistent>       
<db>1</db>                      
<compression_threshold>2048</compression_threshold>
<compression_lib>gzip</compression_lib>            
<log_level>1</log_level>             
<max_concurrency>6</max_concurrency>              
<break_after_frontend>5</break_after_frontend>    
<fail_after>10</fail_after>                        
<break_after_adminhtml>30</break_after_adminhtml>
<first_lifetime>600</first_lifetime>               
<bot_first_lifetime>60</bot_first_lifetime>       
<bot_lifetime>7200</bot_lifetime>                  
<disable_locking>0</disable_locking>              
<min_lifetime>60</min_lifetime>                    
<max_lifetime>2592000</max_lifetime>               
</redis_session>

Magento 2

Edit your session block in env.php to enable Redis sessions on your Magento 2 store.

'session' =>
array (
  'save' => 'redis',
  'redis' =>
  array (
    'host' => 'redis',
    'port' => '6379',
    'password' => '',
    'timeout' => '2.5',
    'persistent_identifier' => '',
    'database' => '2',
    'compression_threshold' => '2048',
    'compression_library' => 'gzip',
    'log_level' => '1',
    'max_concurrency' => '6',
    'break_after_frontend' => '5',
    'break_after_adminhtml' => '30',
    'first_lifetime' => '600',
    'bot_first_lifetime' => '60',
    'bot_lifetime' => '7200',
    'disable_locking' => '0',
    'min_lifetime' => '60',
    'max_lifetime' => '2592000'
  )
),