user1676273 user1676273 - 9 months ago 51
PHP Question

php extension_loaded('memcache') is false, but I can clearly see it running on the server

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/
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/

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?


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


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

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