windows 下启用memcached
•折腾记录
853
0
phpinfo页面查询:
Thread Safety 选项为:disabled 就选择nts版本 否则选择ts版本
打开网址:https://github.com/nono303/memcached/tree/master/cygwin/x64 ,下载:cygevent-2-0-5.dll、cygwin1.dll、memcached-1.5.1.exe
这里直接传一个附件memcached156.rar
最后在对应的php.ini 中添加以下行以启用memcache扩展
extension=php_memcache.dll
查看 phpinfo,查看memcache是否已经存在
新建测试程序:
<?php
$memcache = new Memcache;
$memcache->connect('localhost', 11211) or die ("Could not connect");
$version = $memcache->getVersion();
echo "Server's version: ".$version."<br/>\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)<br/>\n";
$get_result = $memcache->get('key');
echo "Data from the cache:<br/>\n";
var_dump($get_result);
?>
login4