I have an Ubuntu machine with nginx and memcache running, and I'm trying to use PHP with Memcached. I'm getting Fatal error: Class 'Memcached' not found
.
The ini file is loaded from /etc/php5/fpm/php.ini
, and all other additional .ini files are parsed, except memcached.ini (even after restarting nginx) as seen in phpinfo()'s output.
I tried apt-get install php5-memcache
and it completed without errors. However, pecl install memcached
fails with the below error:
In file included from /tmp/pear/temp/memcached/php_memcached.h:22:0,
from /tmp/pear/temp/memcached/php_memcached.c:47:
/tmp/pear/temp/memcached/php_libmemcached_compat.h:5:40: fatal error: libmemcached-1.0/memcached.h: No such file or directory
compilation terminated.
make: *** [php_memcached.lo] Error 1
ERROR: `make' failed
The server has libmemcache in /usr/include/libmemcached
, but even pecl install with --with-libmemcache=/usr/include/libmemcached
fails.
The output for php -i | grep -i memcache
is as below:
/etc/php5/cli/conf.d/memcached.ini,
memcached
memcached support => enabled
libmemcached version => 0.44
Registered save handlers => files user memcached
PWD => /usr/include/libmemcached
_SERVER["PWD"] => /usr/include/libmemcached
I'm not sure what else to check. Much appreciated if someone could help me out with something to fix this.
Thanks!
[UPDATE] Memcached is working from cli.