Home  >  Article  >  php教程  >  Windows环境下 配置memcached (php),memcachedphp

Windows环境下 配置memcached (php),memcachedphp

WBOY
WBOYOriginal
2016-06-13 08:42:21783browse

Windows环境下 配置memcached (php),memcachedphp

memcached就不用介绍了--

1:在Windows下安装memcached服务端软件,已经下载并上传云盘  ---传送门 记得带钥匙:ykrc

解压缩后里面的安装说明内有安装教程。

2:软件安装在服务器主机中,那么php需要一个扩展来连接到memcached,这个扩展就是memcache.dll,也一并下载后上传到云盘 --直升机 记得带汽油:ee5g

解压后可以看到很多php版本对应的扩展,需要选择自己当前php版本对应的扩展,包括线程安全和非线程安全,x86或x64。

复制自己对应的扩展到php配置文件中设置的扩展存放文件夹,一般是在安装跟目录下的ext文件,丢进去!

然后到配置文件中添加 extension=php_memcache.dll,重启服务器软件生效,现在就开心的使用了

3:如果提示非win32应用或不能识别扩展或者其他不明错误,请再三确认是否选对应了的扩展。

4:使用demo:如果正常输出value,则安装成功了

<span>1</span> <?<span>php
</span><span>2</span> 
<span>3</span> <span>$memcache_obj</span> = memcache_connect('localhost', 11211<span>);
</span><span>4</span> <span>$memcache_obj</span>->set('key','value'<span>);
</span><span>5</span> <span>$value</span>=<span>$memcache_obj</span>->get('key'<span>);
</span><span>6</span> <span>echo</span> <span>$value</span>;

 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn