Industrial
Industrial

Reputation: 42758

PHP strange issue with memcache

I am testing out some memcache code here in PHP:

1:

$testInstance = new Memcache;
$var = @$testInstance->connect('localhost', 11211);
echo $var;
// Outputs true no matter if the memcached is running or not.

2:

$testInstance = new Memcache;
$var = @$testInstance->connect('blablabla', 11211);
echo $var;
// Outputs false

Why on earth is this occuring? I am running WinXP in my development environment and I cant see how the localhost version always returns true no matter if the memcached is running or not.

Thanks!

Upvotes: 0

Views: 264

Answers (2)

Industrial
Industrial

Reputation: 42758

The issue went away when i switched to run memcached (not memcache) on a Ubuntu server instead. Really strange...

Upvotes: 0

Kamil Szot
Kamil Szot

Reputation: 17817

Are you sure that memcache is not running on localhost? Maybe it is alive in the background as system service? Put something in and see if you can retrieve it.

Upvotes: 1

Related Questions