Home  >  Article  >  Backend Development  >  Debian装配memcached和php5-memcache模块

Debian装配memcached和php5-memcache模块

WBOY
WBOYOriginal
2016-06-13 12:25:43697browse

Debian安装memcached和php5-memcache模块

1、安装memcached服务及php扩展
apt-get install memcached php5-memcached php5-memcache

2、查看是否安装好memcached服务
ps aux | grep memcached
可以发现安装完memcached是自动启动了的。也可以如下命令查看:
netstat -tap | grep 'memcached'

3、如需修改配置文件
请前往:/etc/memcached.conf
修改完重启
pkill memcached
/usr/bin/memcached restart -p 11211 -u nobody -l 127.0.0.1
最好在网上找个shell脚本,可以直接memcache start

4、最后web server重启下,apache或者nginx的fast-cgi
/etc/init.d/apache2 restart

最后来个简单的例子吧:

  1. $mem =newMemcache;
  2. $mem->connect("localhost",11211);
  3. $mem->set('test','hello world',0,60);
  4. echo $mem->get('test');

如果能看到hello word,就真的ok了。

?

更多请支持:http://www.webyang.net/Html/web/article_171.html

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