2

I just installed memcached on my Mac OS. It installed perfectly and when I type in memcached in Terminal I get this:

failed to listen on TCP port 11211 tcp
listen: Address already in use

And I have a script in my localhost that contains this:

$memcache = new Memcache();
But I get an error thrown saying Fatal error: Class 'Memcache' not found.

How can I get memcached to work, is it because the port 11211 is not listened to which probably doesn't make memcached work?

When I sudo pecl install memcache it shows

pecl/memcache is already installed and is the same as the released version 2.2.7 install failed

Tomas
  • 514
  • 4
  • 13
  • 37
  • Have you checked that `memcached` hadn't already been started? Chances are it had. As for the "Fatal error: Class 'Memcache' not found." error - it has nothing to do with `memcached` being up and running or not. One more thing: `memcache` and `memcached` are not the same thing. Check [this](http://stackoverflow.com/questions/1442411/when-should-i-use-memcache-instead-of-memcached) out for more info. – mrun Feb 19 '16 at 12:26
  • $memcache = new Memcached; and $memcache = new Memcache; both are not working I try this command ps -e | grep memcache | grep -v grep it shows 21476 ?? 0:00.14 /usr/local/bin/memcached -d -p 11211 23196 ?? 0:00.05 memcached -d -p 8000 AND netstat -a -p tcp | grep LISTEN – Tomas Feb 19 '16 at 12:45
  • @mrun When I run sudo pecl install memcache It shows pecl/memcache is already installed But when i run the script it shows Fatal error – Tomas Feb 19 '16 at 13:29
  • It's installed but is it enabled in php.ini? You can find out by running `php -m | grep memcache` and see if there are any entries. – mrun Feb 24 '16 at 08:18

0 Answers0