1

I used memcache for sessions but can not login to both of frontend and backend in mg1810

before this, I did use redis for sessions and now want to use memcache instead of redis

Also did FLUSHALL in redis-cli, memcache service is running and local.xml set to ...

<config>
<global>

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

</global>
</config>
  • 1
    Does php -m list memcached? – Melvyn Apr 26 '14 at 13:47
  • @Melvyn : Great post man, thank you, my problem solved. please add your answer in main page please to accept it – sIiiS Apr 26 '14 at 17:48
2

Magento uses the memcached php extension to communicate with Memcache, but won't warn you if you don't have it.

1

I think you miss the 'cache' tag

<session_save><![CDATA[memcache]]></session_save>
<session_save_path><![CDATA[tcp://localhost:11213?persistent=0&amp;weight=2&amp;timeout=10&amp;retry_interval=10]]></session_save_path> 
<cache>
    <backend><![CDATA[memcached]]></backend>
    <auto_refresh_fast_cache>0</auto_refresh_fast_cache>
    <default_priority>10</default_priority>
    <memcached>
        <servers>
            <server>
                <host><![CDATA[127.0.0.1]]></host>
                <port><![CDATA[11212]]></port>
                <persistent><![CDATA[0]]></persistent>
            </server>
        </servers>
    </memcached>
</cache>

For sessions in redis:

<config>
    <global>
        <!-- other configuration nodes -->
        <session_save>db</session_save>
        <redis_session>                       <!-- All options seen here are the defaults -->
            <host>127.0.0.1</host>            <!-- Specify an absolute path if using a unix socket -->
            <port>6379</port>
            <password></password>             <!-- Specify if your Redis server requires authentication -->
            <timeout>2.5</timeout>            <!-- This is the Redis connection timeout, not the locking timeout -->
            <persistent></persistent>         <!-- Specify unique string to enable persistent connections. -->
            <db>2</db>                        <!-- Redis database number; protection from accidental loss is improved by using a unique DB number for sessions -->
            <compression_threshold>2048</compression_threshold>  <!-- Set to 0 to disable compression (recommended when suhosin.session.encrypt=on); known bug with strings over 64k: https://github.com/colinmollenhour/Cm_Cache_Backend_Redis/issues/18 -->
            <compression_lib>gzip</compression_lib>              <!-- gzip, lzf or snappy -->
            <log_level>4</log_level>               <!-- 0 (emergency: system is unusable), 4 (warning; additional information, recommended), 5 (notice: normal but significant condition), 6 (info: informational messages), 7 (debug: the most information for development/testing) -->
            <max_concurrency>6</max_concurrency>                 <!-- maximum number of processes that can wait for a lock on one session; for large production clusters, set this to at least 10% of the number of PHP processes -->
            <break_after_frontend>5</break_after_frontend>       <!-- seconds to wait for a session lock in the frontend; not as critical as admin -->
            <break_after_adminhtml>30</break_after_adminhtml>
            <bot_lifetime>7200</bot_lifetime>                    <!-- Bots get shorter session lifetimes. 0 to disable -->
        </redis_session>
        <!-- other configuration nodes -->
    </global>
</config>
  • No, I deleted them only here, I use redis cache – sIiiS Apr 26 '14 at 12:36
  • You run Magento CE or EE? – ctasca Apr 26 '14 at 12:40
  • Magento CE version – sIiiS Apr 26 '14 at 12:45
  • check edited answer...that's how I set session in redis. Here is a good article inchoo.net/ecommerce/magento/… – ctasca Apr 26 '14 at 13:35
  • Dear, I know how to set redis for session but I want to use memcache for session and redis for cache, they are different! – sIiiS Apr 26 '14 at 17:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.