XF 1.4 Cache issue config.php

ophy

Member
Hi,

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):

Code:
<?php

$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:

Code:
$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.
 
Opcache is enabled and running however xenforo is not using it.
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.

EDIT:
PHP:
$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(
                        array(
                                'host'             => '127.0.0.1',
                                'port'             => 11211,
                                'weight'           => 1
                        )
                )
        )
);

^^ That is what you need to use with Memcache (and you also need the PHP memcache module installed and loaded)
 
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.

Thanks!
 
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.
 
@MattW

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?:

Code:
$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(
        array(
        'host'             => '127.0.0.1',
        'port'             => 11211,
        'weight'           => 1
        )
    )
    )
);
 
@MattW

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

Code:
$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(
        array(
        'host'             => '127.0.0.1',
        'port'             => 11211,
        'weight'           => 1
        )
    )
    )
);
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.
 
Top Bottom