1

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
3
  • 1
    Any specific reason you didn't install memcache via YUM – Napster_X Dec 23 '12 at 5:33
  • None, I can go and try to reinstall using YUM. – Jonas Kaufmann Dec 23 '12 at 5:35
  • Got it working using YUM. I think my main error is that someone somehow decided to sometimes name it "memecached" and sometimes name it "memecache" (I know these two are different, yet the first one needs to use MEMCACHE.SO)... – Jonas Kaufmann Dec 23 '12 at 5:49
2

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.

4
  • I now have the extension "memcache" enabled and running. I hope it is the right one ;) – Jonas Kaufmann Dec 23 '12 at 5:50
  • great ... that's awesome. – Napster_X Dec 23 '12 at 5:51
  • $memcache = new Memcache; works, so I believe it is the right one. GREAT :) – Jonas Kaufmann Dec 23 '12 at 5:52
  • 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. – Forest Jan 16 '13 at 3:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.