Toni Michel Caubet
Toni Michel Caubet

Reputation: 20163

Can't connect to memcache

I am trying to connect to memcache as they suggest:

$memcache = new Memcache();
$memcache->pconnect('localhost',11211);

But i get:

Notice: Memcache::pconnect() [memcache.pconnect]: Server localhost (tcp 11211) failed with: Connection refused (111) in /home/user/public_html/website.com/includes/basedatos.php on line 26

Any idea why?

Upvotes: 15

Views: 38803

Answers (3)

Andrew Rout
Andrew Rout

Reputation: 247

This may be obvious, but make sure that memcached is actually running:

service memcached start

Upvotes: 18

S. Ali Mihandoost
S. Ali Mihandoost

Reputation: 3104

memcache is diffrent with memcached

and i thing you have installed memcache because $memcache = new Memcache(); worked

you must started it on your server

check this 10 baby steps to install Memcached Server and access it with PHP

Upvotes: 6

Amber
Amber

Reputation: 526613

You need to actually install the memcached server so that it can be connected to. On CentOS, this can be done with...

sudo yum install memcached

(on debian flavors of linux, use apt-get instead of yum)

Upvotes: 23

Related Questions