1

here's a grep of ps aux on my dev server

498       1575  0.0  0.0 330852   152 ?        Ssl  Jun14   2:58 memcached -d -p 11211 -u memcached -m 64 -c 1024 -P /var/run/memcached/memcached.pid
498       6446  0.0  0.0 330852   152 ?        Ssl  Jul23   1:09 memcached -d -p 11212 -u memcached -m 64 -c 1024 -P /var/run/memcached-2/memcached-2.pid

So I can see that it is there, I'm using zend framework with 'Memcached' backend, which is using a the extension_loaded('memcache') to see if it is installed.

Is this because they installed memcached2? but if so why would the extension loaded function fail? I'm not much of a server junkie, but my guess is something went wrong in the installation process?

TL;DR;

Why does extension_loaded('memcache') return false, when memcached is running on the server?

3 Answers3

4

You're confusing the memcached service which is running on your server and php extensions (Memcache and Memcached) which required to talk with that running service.

You have to install one or both of that extensions to use memcached inside your application. (I recommend the Memcache(d) one.) After successfully installed the extension(s), check it on your server using the command below:

$ php -m | grep memcache

If you have both extensions, output would be:

 $ php -m | grep memcache
   memcache
   memcached

In your case, Zend Framework trying to use memcache extension (not memcached) which is probably not installed on your box.

edigu
  • 9,878
  • 5
  • 57
  • 80
3

As far as i know, memcache is not memcached. Check if you are checking proper extension (check for memcached). I don't have much experience, because I've used redis for caching.

link: Memcache Vs. Memcached

Community
  • 1
  • 1
mrarm
  • 140
  • 9
0

Well it seems as though the php module is missing, but the daemon is running, When I run a php -m I do not see memcache as an installed extension, so I'll need to get that installed.

@mrarm that link did help! but both extension_loaded of memcached, and memcache return false, apparently I do need memcache, but it's daemon is named memcached. Stupid naming!

  • 2
    No! The server is called `memcached`. There are 2 PHP modules `memcache` and `memcached` which both can access the server. You need to install one of those modules (I prefere `memcached`), to access the `memcached` server. – Daniel W. Aug 20 '14 at 13:34