PDA

View Full Version : Memcache may not work, how to configure config.php for memcache?


postcd
01-18-2016, 09:26 AM
Hello,

my caching plugin vB Optimize says this when runing test:

Running Test: Fetch Cache
" Your Opcache Operator extension is functioning, however it is unable to store data. Please check your extension configuration."

The operator is set to Memcache.

And this is from phpinfo:

memcache support enabled
Active persistent connections 0
Version 2.2.7
Revision $Revision: 327750 $

Directive Local Value Master Value
memcache.allow_failover 1 1
memcache.chunk_size 8192 8192
memcache.default_port 11211 11211
memcache.default_timeout_ms 1000 1000
memcache.hash_function crc32 crc32
memcache.hash_strategy standard standard
memcache.max_failover_attempts 20 20

This is from vbulletin config.php

/*
$config['Datastore']['class'] = 'vB_Datastore_Memcached';
$i = 0;
// First Server
$i++;
$config['Misc']['memcacheserver'][$i] = '127.0.0.1';
$config['Misc']['memcacheport'][$i] = 11211;
$config['Misc']['memcachepersistent'][$i] = true;
$config['Misc']['memcacheweight'][$i] = 1;
$config['Misc']['memcachetimeout'][$i] = 1;
$config['Misc']['memcacheretry_interval'][$i] = 15;
*/



i wanted to ask what steps to do to fix this? Thank you

Dragonsys
01-18-2016, 02:26 PM
This is from vbulletin config.php

That section is commented out. Remove the /* at the start and */ at the end to uncomment it.

squidsk
01-18-2016, 02:32 PM
Have you independently verified that memcache is in fact not working?

Run the following script twice to confirm memcache's functionality:

<?php
$mem = new Memcached();
$mem->addServer("127.0.0.1", 11211);

$result = $mem->get("blah");

if ($result) {
echo $result;
} else {
echo "No matching key found. I'll add that now!";
$mem->set("blah", "I am data! I am held in memcached!") or die("Couldn't save anything to memcached...");
}
?>

postcd
01-18-2016, 04:19 PM
I uncommented that and "Fetch cache" worked, BUT "Flush cache" not with error:

"Your Opcache Operator extension is unable to flush variables. Please check your extension configuration."

i tried running squidsk script and it says:
"Fatal error: Class 'Memcached' not found in /home/username/public_html/i.php on line 2"

On line 2 when i change Memcached to Memcache, it says:
"No matching key found. I'll add that now!"
nothing else

any idea please? :-(

Dave
01-18-2016, 04:32 PM
Memcached is not the same as Memcache. They are different modules.

postcd
01-18-2016, 07:23 PM
Memcached is not the same as Memcache. They are different modules.
I know, and how it solves the issue, i dont understand. Im using memcache i believe.

webmastersun
01-19-2016, 03:11 AM
Have you set memcached port and enable it on your server after installed?

postcd
01-19-2016, 08:48 AM
Have you set memcached port and enable it on your server after installed?

# service memcached status
memcached (pid 1200) is running...

# cat /etc/init.d/memcached | grep =
PORT=11211
USER=memcached
MAXCONN=1024
CACHESIZE=256
OPTIONS=""
if [ "$NETWORKING" = "no" ]
RETVAL=0
prog="memcached"
pidfile=${PIDFILE-/var/run/memcached/memcached.pid}
lockfile=${LOCKFILE-/var/lock/subsys/memcached}
if [ "`stat -c %U /var/run/memcached`" != "$USER" ]; then
RETVAL=$?
RETVAL=$?
RETVAL=$?
RETVAL=2

# cat /etc/csf/csf.conf | grep 11211
nothing

csf.conf is firewall CSF configuration file, so i added 11211 to the TCP_IN and TCP_OUT (good step or not necessary?), restarted firewall "csf -r"

and then tried testing php script provided above by member "Dragonsys"

It returned error on line 2 again, but when changed Memcached to Memcache (is it correct didnt i break script testing purpose?), it says: "I am data! I am held in memcached!"

my vbulletin vB Optimize addon stil said:
"Your Opcache Operator extension is functioning, however it is unable to store data. Please check your extension configuration."

(i set memcache as operator in that plugin)
:-(

--------------- Added 1453243211 at 1453243211 ---------------

im back with "Your Opcache Operator extension is unable to flush variables." error :(