How to fix a problem with the memcache dialing method always crashing?

I have XAMPP 1.7.3 installed on Windows 7. PHP version is 5.3.1. I have successfully installed memcache for win32 from http://www.splinedancer.com/memcached-win32 .

I got the php_memcache.dll PHP extension from http://downloads.php.net/pierre .

Restarting apache and checking phpinfo () shows that memcache is ok.

When I test it below the PHP page. It always fails in the given method.

<?php
$memcache = new Memcache;
$memcache->connect('127.0.0.1', 11211) or die ("Could not connect");

$version = $memcache->getVersion();
echo "Server version: ".$version." \n";

$tmp_object = new stdClass;
$tmp_object->str_attr = 'test';
$tmp_object->int_attr = 123;

$memcache->set('key', $tmp_object, false, 10) or die ("Failed to save data at the server");
echo "Store data in the cache (data will expire in 10 seconds)\n";

$get_result = $memcache->get('key');
echo "Data from the cache: \n"
?>

The set method always returns false, so it constantly outputs

Server version: Failed to save data at the server

I am stuck. I do not know which way to deal with this problem. Does anyone have an idea of ​​a possible direction?

Thank.

+3
2

, , Memcache Windows. , , phpinfo() , , memcache... , , - ? , Windows , ""...

0

- php?
var_dump($memcache->getStats())
memcache
, memcache telnet 127.0.0.1 11211
memcache... Windows ?

0
source

Source: https://habr.com/ru/post/1738637/


All Articles