Installed by Memcached (Theoretically), PHP Cannot Use Memcache_connect ()

Just finished installing libevent (1.4.8), memcached (1.4.5), pears and libmemcached (0.40) on my lamp server (running PHP 5.2.10 and Centos 5.5 Final), and as far as I can tell, everything is installed correctly ( failed to resolve all errors during installation).

However, after the final update and installation of all updates ... when you try to do one of the following:

$test=memcache_connect('127.0.0.1', 11211); // OR $memcache = new Memcache; $memcache->connect('127.0.0.1', 11211) 

I get errors:

Fatal error: Class 'Memcache' not found (or) Fatal error: call to undefined function memcache_connect ()

I (admittedly) am not very good at Linux at this point, although after installing this server completely from scratch, I will certainly advance in the learning process :) Any help would be greatly appreciated!

phpinfo () Shows memcached is enabled

+8
php caching memcached centos pear
source share
2 answers

You installed the Memcached client (and not the Memcache client, which is very vague, also the Memcached client). Use the Memcached class instead.

If you're wondering what the difference is between the two clients: here is a good comparison table .

+12
source share

It looks like you still need pecl / memcache or pecl / memcached (client / php end)

pecl / memcached will use libmemcached.

pecl / memcache has no such dependency.

 Some of notes on how to install pecl/memcached Yum install: * memcached * memcached-devel * php-pear * php-devel * gcc * gcc-c++ * zlib-devel Download libmemcached from: http://download.tangent.org/ Configure, Make, Make install pecl install memcached added "extension=memcached.so" to php.ini 
+2
source share

All Articles