Home > php教程 > php手册 > linux ubuntu下安装php memcache扩展

linux ubuntu下安装php memcache扩展

WBOY
Release: 2016-06-06 20:12:55
Original
1013 people have browsed it

memcached 安装 sudo apt-get install memcached memcached 参数说明 memcached -d -m 50 -p 11211 -u root -m 指定使用多少兆的缓存空间;-p 指定要监听的端口; -u 指定以哪个用户来运行 安装php-memcache模块 sudo apt-get install php5-memcache 编辑配

memcached 安装
sudo apt-get install memcached

memcached 参数说明
memcached -d -m 50 -p 11211 -u root
-m 指定使用多少兆的缓存空间;-p 指定要监听的端口; -u 指定以哪个用户来运行

安装php-memcache模块
sudo apt-get install php5-memcache

编辑配置文件
sudo vi /etc/php5/conf.d/memcache.ini
;uncomment the next line to enable the module
extension=memcache.so

[memcache]
memcache.dbpath=”/var/lib/memcache”
memcache.maxreclevel=0
memcache.maxfiles=0
memcache.archivememlim=0
memcache.maxfilesize=0
memcache.maxratio=0
在phpinfo()查看memcache的相关配置
测试:

$mem = new Memcache;
$mem->connect("127.0.0.1", 11211);
$mem->set('key', 'This is a memcached test!', 0, 60);
$val = $mem->get('key');
echo $val;
Copy after login
Related labels:
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template