Centos – Can’t get memcached to run on CentOS 5.8

centosmemcachedPHP

so I want to install memcached on my CentOS 5.8 server.

I followed this tutorial http://kb.liquidweb.com/install-memcached-on-centos-5/

The command

  netstat -ap | grep 11511

shows that memcached is running.

I have added

extension = memcached.so

to php.ini and restarted the Apache server.

I am also positive that I chose the right php.ini (verified by phpinfo();).

Yet, it still does not work, neither shows it up in phpinfo();


What am I doing wrong? Can you help, please?


EDIT: when I run

php

I get the following error:

Unable to load dynamic library '/usr/lib64/php/modules/memcached.so' - /usr/lib64/php/modules/memcached.so: cannot open shared object file: No such file or directory in Unknown on line 0

Best Answer

Ok, so the problem here is that you are using different memcache for some different purpose.

The one which works with PHP is this one.

To use this, download it from the URL given and follow the below steps to install it.

  • Untar the tar ball.
  • phpize (if this is not installed, install it first)
  • ./configure
  • make && make install
  • cp modules/memcache.so /usr/lib64/php/modules/

Then restart the Web server. It should work.

Also, please remove any other memcache you have installe earlier, just to prevent any conflicts.

Also, I believe you can install the same through yum also with this command:

# yum install php-pecl-memcached

NB: This yum command will install pecl-memcached, however the php.net page linked above is for pecl-memcache. These are 2 different extensions, as noted in mit's comment on that page.