• 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

Chad

Active member
#1
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.
 

Mike

XenForo developer
Staff member
#2
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.
 

Chad

Active member
#3
Hi Mike,

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

Mike

XenForo developer
Staff member
#4
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);
 

Chad

Active member
#5
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);
 

Chad

Active member
#6
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.
 

Attachments

Chad

Active member
#8
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
 

MattW

Well-known member
#9
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?
 

Chad

Active member
#10
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 :::*
 

MattW

Well-known member
#11
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]#
 

Chad

Active member
#12
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,
        )
    )
);