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

XF 1.4 Cache issue config.php

Discussion in 'Troubleshooting and Problems' started by ophy, Jun 20, 2016.

  1. ophy

    ophy Member


    I recently stopped using xcache and enabled opcache on my server. In the config.php file I currently have (after removing the backend store option for xcache):

    $config['db']['host'] = 'localhost';
    $config['db']['port'] = '3306';
    $config['db']['username'] = 'xxx';
    $config['db']['password'] = 'xxx';
    $config['db']['dbname'] = 'xxx';
    $config['superAdmins'] = 'xxx';
    $config['cache']['cacheSessions'] = true;
    $config['cache']['backend'] = 'File';
    Opcache is enabled and running however xenforo is not using it.

    I'm quite sure I need to add the following to my config.php:

    $config['cache']['enabled'] = true;
    $config['cache']['frontend'] = 'Core';
    $config['cache']['frontendOptions']['cache_id_prefix'] = 'xf_';
    As per https://xenforo.com/help/cache/, however when I add the above to my config.php I get a white page with the message of an unexpected database error occurred, please try again later", I've viewed the source code but it doesn't show up with anything, the xenforo databases are labeled as xf_

    I'm not sure what's causing this, but without the above code which gives me the error, my xenforo installation isn't utilising opcache properly.

    I have also tried to use memcache as a backend cache, however after installing and activation it caused a 500 service error, so I removed it.

    Any help would be appreciated, thanks!

    I'm running 1.4.4 and using MySQL on a dedicated server.
  2. MattW

    MattW Well-Known Member

    XenForo doesn't need any configuration for Opcache, that will be used by PHP as long as you have the correct settings in your php.ini to enable it.

    Xcache does both session and php file caching, Opcache doesn't, so you'll need to install Memcached or Redis and use those for the backend caching.

    $config['cache'] = array(
    'enabled'                      => true,
    'frontend'                     => 'Core',
    'frontendOptions'              => array(
    'caching'                  => true,
    'cache_id_prefix'          => 'xf_',
    'automatic_serialization'  => false,
    'lifetime'                 => 0),
    'backend'                      => 'Memcached',
    'backendOptions'               => array(
    'servers'                  => array(
    'host'             => '',
    'port'             => 11211,
    'weight'           => 1
    ^^ That is what you need to use with Memcache (and you also need the PHP memcache module installed and loaded)
  3. ophy

    ophy Member

    Hi Matt,

    Thanks for your reply, I had those similar settings, but as I stated once I installed memcache I just got 500 server errors (on my whole server, so some other sites not running xenforo) so I rebuilt apache and uninstalled it to fix the issue!

    Do you know why when I enter those settings I get the database error? Also I have opcache enabled and my opcache plugin says it's working (as does my php info page I created) however it doesn't seem to cache the xenforo install.

  4. ophy

    ophy Member


    Sorry for the double post, but any more help from anyone with insight would be much appreciated!
  5. ophy

    ophy Member

    Don't know how many times I'm allowed to post but still no further replies any help would be appreciated.
  6. Tracy Perry

    Tracy Perry Well-Known Member

    What version of PHP?
    What OS?
  7. ophy

    ophy Member

    Hi thanks for the reply.

    Php 5.5.36 and centos x7
  8. Tracy Perry

    Tracy Perry Well-Known Member

    OK... there was an issue with memcached if I remember that an update resolved. Main thing I was curios about was if it was PHP 7 as I know they had some PECL issues (like no PECL) for a while but thought that they had resolved that.
    Also, make sure you don't have the port firewalled off for local use.
  9. audiokid

    audiokid Active Member


    My server support set up memcached like this last night but I am starting to get white pages. This is what they used for the config file as well. Its different from yours. Should I change it to what you have?:

    $config['cache'] = array(
        'enabled'                      => true,
        'cacheSessions'                => true,
        'frontend'                     => 'Core',
        'frontendOptions'              => array(
        'caching'                  => true,
        'cache_id_prefix'          => 'xf_',
        'automatic_serialization'  => true,
        'lifetime'                 => 0),
        'backend'                      => 'Libmemcached',
        'backendOptions'               => array(
        'servers'                  => array(
            'host'             => '',
            'port'             => 11211,
            'weight'           => 1
  10. audiokid

    audiokid Active Member

    PS, mine is set to false yours is true. What does this do? Thanks for any help :)
    'automatic_serialization' => true,
  11. audiokid

    audiokid Active Member

    Update for anyone that runs into this nightmare of wasting hours trying to understand why you are getting white pages once and a while.
    A broken google doubleclick ad will create a large white space. My client takes theirs down on googles CP and doesn't update it with a new one. Erk!
    This will create a white space every time the bad ad exposes.

Share This Page