Store
Community Documentation

v3 Knowledgebase

How to enable Memcached?

Notice: This feature requires phpFox 2.0.5 or higher

Modifying most settings for phpFox can be done from your AdminCP, however Memcached deals with system wide caching and if miss-configured can lead to an unusable site. With that said it shouldn't keep you away for using Memcached, its an amazing method to handle site wide caching compared to using flat files; which is what we used by default. You can spread your sites cache across several Memcached servers, which is especially useful if you are setting up a load balanced environment. This article will guide you on how to enable Memcached with phpFox assuming your server(s) already has/have support for Memcached and is already running.

Before we start its important to set this up on a test environment or least when your site is offline. When setting this up and if at anytime you get a "blank" page or your site simply does not work make sure to enable debug mode. More information on that can be found here.

Let's begin.

First, open the file:

include/setting/server.sett.php

Look for:

$_CONF['core.cache_storage'] = 'file';

Replace that with:

$_CONF['core.cache_storage'] = 'memcache';

Next, look for:

$_CONF['core.memcache_hosts'] = array();

This will hold an array of your Memcached servers. Its a good idea to have a separate server for Memcached instead of using the same server to store memory cached files as your web server. To start we will just add one Memcached server. To do that we need to specify a host and a port number. An example would be:

$_CONF['core.memcache_hosts'] = array(
	array(
		'host' => '192.168.0.195',
		'port' => '11211'
	)
);

Notice that the host and port used is just an example. You may need to verify with your host or server administrator what the correct information is.

If you want to add more then one server it would look like:

$_CONF['core.memcache_hosts'] = array(
	array(
		'host' => '192.168.0.195',
		'port' => '11211'
	),
	array(
		'host' => '192.168.0.196',
		'port' => '11211'
	),
	array(
		'host' => '192.168.0.197',
		'port' => '11211'
	)
);