I am trying to get Memcached working. I have a Memcached server running, but it is on a different machine (so different IP address). I have configured the firewall so that my StatusNet host can telnet into Memcached with no problem, but I am now having problems getting the plugin to work.
I am using the master copy of StatusNet from gitorious and I have noticed that there are two plugins, Memcache and Memcached that are not very different. Is one better to use? I tried invoking simply by adding
addPlugins('Memcached');
to config.php and editing the line in the plugin code to
public $servers = array('111.111.111.111;11211');
(replacing 111.111.111.111 with the address of my Memcached server). When I do that, I get a black screen, no log mesages. Trying the same thing on a home installation (running 0.9.0) I get an error message on screen:
Fatal error: Class 'Memcache' not found in /var/www/statusnet/plugins/MemcachePlugin.php on line 201
Any tips would be appreciated!
Comments
config['memcached']['enabled'] = true;
$config['memcached']['server'] = '111.111.111.111';
$config['memcached']['based'] = 'myname';
and I get the same errors (i.e. blank screen and Fatal error msg respectively).
Here is my config file when I have it turned on:
$config['memcached']['enabled'] = true;
$config['memcached']['server'] = 'localhost';
$config['memcached']['port'] = 11211;
Of course, Im running it on the same machine as the web server. I have 3 servers, mysql, web, and jabber/meteor. All communicating by internal ip.
I don't get errors when I turn it on, and it seems to speed things up for sure, however during all this dev work I have it turned off to eliminate the cache as an issue.
I don't recall doing anything special when installed the memcached on my ubuntu, so I'm affraid I'm not much help with your particular issue :(
$config['memcached']['enabled'] = true;
$config['memcached']['server'] = 'localhost';
$config['memcached']['port'] = 11211;
on the local test server with no luck (still get the fatal error).
how are you launching the memcached daemon?
what does sudo netstat -plunt | grep memcached return?
STAT pid 18631
STAT uptime 300137
STAT time 1270510330
STAT version 1.2.2
STAT pointer_size 64
STAT rusage_user 0.008000
STAT rusage_system 0.000000
STAT curr_items 1
STAT total_item 2
STAT bytes 65
STAT curr_connections 1
STAT total_connections 6
STAT connection_structures 2
STAT cmd_get 3
STAT cmd_set 8
STAT get_hits 3
STAT get_misses 0
STAT evictions 0
STAT bytes_read 314
STAT bytes_written 1734
STAT limit_maxbytes 67108864
STAT threads 1
END
I start memcached using the /etc/init.d/memcached script.
That netstat command returns
tcp 0 0 0.0.0.0:11211 0.0.0.0:* LISTEN 18631/memcached
Fatal error: Class 'Memcache' not found in /var/www/statusnet/plugins/MemcachePlugin.php on line 201
Our memcache plugin requires that PHP's memcache extension be enabled and loaded. This may be installable as 'php5-memcache' or a similar package name on the system if your PHP setup is managed by distro packages.
Be warned also that there are both 'memcache' and 'memcached' extensions for PHP, which are slightly different. In 0.9.x so far we only support the 'memcache' one by default, though Craig did some work on a version that uses the 'memcached' extension as well.
The 2 second timeout code works great btw, finally have a fix for that.
BTW I have memcached on the same server as the web server and only have it active there when I do (not testing stuff).
sudo /etc/init.d/apache2 reload