3

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?

the_velour_fog
  • 497
  • 2
  • 4
  • 14

3 Answers3

6

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.)

Michael Hampton
  • 244,070
  • 43
  • 506
  • 972
  • 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? – the_velour_fog Mar 21 '15 at 01: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. – Michael Hampton Mar 21 '15 at 02:00
  • ah, so `memcache` is simply a PHP extension and not a daemon. `memcached` provides similar functionality but does run as a daemon/service? – the_velour_fog Mar 21 '15 at 02:02
  • 1
    Right, you need an actual `memcached` daemon to talk to. – Michael Hampton Mar 21 '15 at 02: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
  • 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. – the_velour_fog Mar 21 '15 at 02: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