4

I have just installed memcache on (not memcached) on Ubuntu 14.04 via

sudo pecl install memcache

the module is showing as loaded in phpinfo output.
But I cant see if the daemon is running.
I have tried

  • sudo ps -e | grep memcache
  • sudo ps -e | grep memcache
  • sudo service memcache status -> sudo: /etc/init.d/memcache: command not found
  • sudo /etc/init.d/memcache status -> memcache: unrecognized service

Most google searches give instructions for memcached which doesnt work for me

how can i check if memcache is running?

3 Answers 3

7

You have only installed the PHP language bindings, which allow PHP to communicate with memcached. You haven't actually installed memcached. If you want to run memcached, you will need to install it. (And there is no such daemon as memcache.)

4
  • thanks, I wondered that, because they are written by different authors, I thought they were totally different packages which might clash if installed side by side. are you saying that they are meant to be run together , i.e. memcache provides API to PHP and memcached provide a utility purpose, like starting, stopping, status reporting etc? Mar 21, 2015 at 1:59
  • They're just two completely different and incompatible language bindings for memcached. The one without the d is the older one and the one with the d is currently maintained. You should use whichever one the application you're deploying requires. It's also safe to install both. But note that data written to memcached with one can't be read by the other. Mar 21, 2015 at 2:00
  • ah, so memcache is simply a PHP extension and not a daemon. memcached provides similar functionality but does run as a daemon/service? Mar 21, 2015 at 2:02
  • 1
    Right, you need an actual memcached daemon to talk to. Mar 21, 2015 at 2:03
4

Could it be your memcached binary is deleted or you haven't installed the memcached package yet?

➜ ~ which memcached
/usr/bin/memcached
➜  ~  service memcached status
 * memcached is running
➜  ~  lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.2 LTS
Release:    14.04
Codename:   trusty
1
  • thanks, memcached is not being used in the project at all, the only reason I installed the older memcache is because I'm debugging a website that used it, so I'm trying to replicate the production environment as closely as possible. Mar 21, 2015 at 2:09
1

First thing to do is check and see if the port is listening:

netstat -anp | grep LISTEN | grep mem

Next check to make sure it is not stalled:

echo "stats" | nc localhost 11211 or what ever host/port yours is listening on.

source: https://briansnelson.com/Check_if_Memcached_is_Running

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .