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

Why does my site go "unexpected error" when I enable caching?

Discussion in 'Server Configuration and Hosting' started by Coop1979, Jun 22, 2016.

Tags:
  1. Coop1979

    Coop1979 Well-Known Member

    This has been plaguing me and I feel like there's a simple solution. I recently upgraded to PHP 7 and since then my cache setttings won't work. At first I thought it was because opcache and memcached weren't properly compiled into my install of PHP7, but I have subsequently rebuilt it and in my phpinfo page it shows Memcached and Opcache compiled correctly.

    But, I'm still having troubles with the site throwing the "An unexpected error occurred. Please try again later." error.

    This is my config section with the caching details:

    PHP:
    $config['cache']['enabled'] = true;
    $config['cache']['frontend'] = 'Core';
    $config['cache']['frontendOptions']['cache_id_prefix'] = 'pc_';
    $config['cache']['cacheSessions'] = true;

    $config['cache']['backend'] = 'Memcached';
    $config['cache']['backendOptions'] = array(
        
    'compression' => false,
        
    'servers' => array(
            array(
                
    // your memcached server IP /address
                
    'host' => 'localhost',
              
                
    // memcached port
                
    'port' => 11211,
            )
        )
    );
     
  2. Coop1979

    Coop1979 Well-Known Member

    OK, I've narrowed it down to a Memcached issue. Normal caching works, but if I enable Memcached it throws the error. After doing some reading, it appears that XenForo requires "Memcache", which is not available on PHP 7.

    Is that correct?
     
  3. RoldanLT

    RoldanLT Well-Known Member

    I think both Memcache/Memcached/Libmemcached are all supported by XenForo.
    Maybe I'm wrong.
     
  4. Jeremy P

    Jeremy P Well-Known Member

    I believe so, the "memcache" extension wasn't working with PHP 7 last I checked. I have had success in using Libmemcached (memcached) as a caching back-end with PHP 7. It's not documented in the XenForo manual, but it is bundled with XenForo in the Zend Framework and appears to work fine out of the box.

    http://framework.zend.com/manual/1.12/en/zend.cache.backends.html#zend.cache.backends.libmemcached
     

Share This Page