1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.4 caching issue

Discussion in 'Troubleshooting and Problems' started by Chad, Jan 5, 2015.

  1. Chad

    Chad Active Member

    Trying to set up memcache for XF.

    Installed on my dedicated box using this without a hitch;
    http://www.servernoobs.com/install-memcache-onto-cpanel-running-centos/

    Code:
    root@server [~]# ps -e | grep memcached
    30900 ?  00:00:00 memcached

    Followed XF's doc:
    https://xenforo.com/help/cache/

    My /library/config.php file I've added this:

    Code:
    / ** CACHING ** /
    
    $config['cache']['enabled'] = true;
    $config['cache']['frontend'] = 'Core';
    $config['cache']['frontendOptions']['cache_id_prefix'] = 'xf_';
    
    $config['cache']['backend'] = 'Memcached';
    $config['cache']['backendOptions'] = array(
        'compression' => false,
        'servers' => array(
            array(
                // your memcached server IP /address
                'host' => 'localhost',
              
                // memcached port
                'port' => 11211,
            )
        )
    );
    Resulted in blank page loads.
     
  2. Mike

    Mike XenForo Developer Staff Member

    It should give you an error message if not, but do you have the "memcache" extension enabled in PHP? (See your PHP info.) You need that to use that caching method.
     
  3. Chad

    Chad Active Member

    Hi Mike,

    Yes memcache.so was in php.ini and apache restarted, etc. It's there and was set up correctly.
     
  4. Mike

    Mike XenForo Developer Staff Member

    Can you turn on display_errors in PHP to see if anything shows up? You can do it in php.ini or it should be doable in config.php:
    Code:
    ini_set('display_errors', true);
     
  5. Chad

    Chad Active Member

    Real strange.

    I added this to config.php and reloaded my site. Still nothing, completely blank.

    Code:
    / ** CACHING ** /
    
    $config['cache']['enabled'] = true;
    $config['cache']['frontend'] = 'Core';
    $config['cache']['frontendOptions']['cache_id_prefix'] = 'xf_';
    
    $config['cache']['backend'] = 'Memcached';
    $config['cache']['backendOptions'] = array(
        'compression' => false,
        'servers' => array(
            array(
                // your memcached server IP /address
                'host' => 'localhost',
             
                // memcached port
                'port' => 11211,
            )
        )
    );
    
    ini_set('display_errors', true);
     
  6. Chad

    Chad Active Member

    Just some more info to show you it's installed at least.

    root@server [~]# ps -e | grep memcached
    30900 ? 00:00:00 memcached

    Within the php.in file

    extension="memcache.so"

    Apache restarted.
     

    Attached Files:

  7. MattW

    MattW Well-Known Member

    Can you do a ps -ef | grep memcached so we can see all the options it's being started with?
     
  8. Chad

    Chad Active Member

    root@server [~]# ps -ef | grep memcached
    root 6616 6587 0 21:15 pts/0 00:00:00 grep memcached
    495 30900 1 0 13:44 ? 00:00:00 memcached -d -p 11211 -u memcached -m 64 -c 1024 -P /var/run/memcached/memcached.pid

    Thanks @MattW
     
  9. MattW

    MattW Well-Known Member

    That looks like it's running as the daemon, and not actually posting the listen to localhost.

    This is what mine looks like:
    Code:
    /usr/bin/memcached -d -l 127.0.0.1 -p 11211 -U 11211 -P /var/run/memcached/memcached.pid -u memcached -m 128 -o slab_reassign slab_automove
    What do you have in the memcached config file?

    Can you try a netstat -an | grep 11211 and see if there is actually a TCP listen being posted?
     
  10. Chad

    Chad Active Member

    root@server [~]# netstat -an | grep 11211
    tcp 0 0 0.0.0.0:11211 0.0.0.0:* LISTEN
    tcp 0 0 :::11211 :::* LISTEN
    udp 0 0 0.0.0.0:11211 0.0.0.0:*
    udp 0 0 :::11211 :::*
     
  11. MattW

    MattW Well-Known Member

    It's there, but your ps -ef isn't showing the -l switch for 127.0.0.1

    Code:
    [root@host library]# netstat -an | grep 11211
    tcp        0      0 127.0.0.1:11211             0.0.0.0:*                   LISTEN     
    udp        0      0 127.0.0.1:11211             0.0.0.0:*                              
    [root@host library]#
     
  12. Chad

    Chad Active Member

    Hey @MattW

    I figured it out. It was the / ** Cache ** / line. I removed it. No more blank pages.

    Just curious, can you recommend optimal memcache settings for XF? Super speedy page loads and all :)

    This is what I have as default in config

    Code:
    $config['cache']['enabled'] = true;
    $config['cache']['frontend'] = 'Core';
    $config['cache']['frontendOptions']['cache_id_prefix'] = 'xf_';
    
    $config['cache']['backend'] = 'Memcached';
    $config['cache']['backendOptions'] = array(
        'compression' => false,
        'servers' => array(
            array(
                // your memcached server IP /address
                'host' => 'localhost',
            
                // memcached port
                'port' => 11211,
            )
        )
    );
     

Share This Page