CentOS环境PHP下安装memcache扩展
来源:互联网 发布:知乎英文怎么说 编辑:程序博客网 时间:2024/05/16 06:43
1、安装libmemcached库
yum install libmemcached
2、下载并解压memcache文件
wget http://pecl.php.net/get/memcache-3.0.8.tgz
tar xzvf memcache-3.0.8.tgz
cd memcache-3.0.8
3、执行phpize扩展安装程序,假设phpzie的路径为/usr/local/php/bin/phpize,具体的路径得根据自己的环境修改。
[root@naginx memcache-3.0.8]# /usr/local/php/bin/phpize
Configuring for:
PHP Api Version: 20100412
Zend Module Api No: 20100525
Zend Extension Api No: 220100525
4、开始安装扩展memcache
[root@naginx memcache-3.0.8]# ./configure --enable-memcache \
--with-php-config=/usr/local/php/bin/php-config --with-zlib-dir \
make && make install
安装完成后,提示
Build complete.
Don't forget to run 'make test'.
Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/
5、最后修改php.ini文件,在zend之前加入如下代码。
vim /usr/local/php/lib/php.ini
extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/memcache.so
6、重新启动php-fpm
kill -QUIT pid
/etc/rc.d/init.d/php-fpm restart
7、通过phpinfo()可以查看memcached信息
8、启动memecached
./memcached -d -m 100 -l 192.168.1.120 -p 11211 -u root
9、测试
附php的memcache测试代码:
<?php
$mem = new Memcache;
$mem->connect("192.168.1.120", 11211) or die("Could not connect");
$version = $mem->getVersion();
echo "Server's version: ".$version."<br/>\n";
$mem->set('hellokey', 'Hello World', 0, 600) or die("Failed to save data at the memcached server");
echo "Store data in the cache (data will expire in 600 seconds)<br/>\n";
$get_result = $mem->get('hellokey');
echo "$get_result is from memcached server.";
?>
查看命中结果
telnet 192.168.1.120 11211
输入命令:status
0 0
- CentOS环境PHP下安装memcache扩展
- CentOS环境PHP下安装memcache扩展
- 万网云翔主机centos系统下为PHP安装扩展memcache
- centos 安装php Memcache 环境
- linux centos 安装php的memcache扩展
- Centos 6.4 安装Memcache 和 PHP Memcache扩展
- windwos下安装php的memcache扩展
- MAC下安装php扩展memcache
- Mac下PHP安装Memcache扩展
- Linux下PHP安装Memcache扩展
- Linux下php安装memcache扩展
- Linux下php安装memcache扩展
- ubuntu下安装php memcache扩展
- Windows下PHP 安装 memcache扩展
- windows下wamp安装php-memcache扩展
- ubuntu 下安装memcache 以及php扩展
- centos环境下为php安装扩展sysvmsg
- centos环境下为php安装sysvmsg扩展
- 使用ROS的rqt_plot对任意语言的程序进行可视化
- guava之Multiset
- 17年1月9日,小程序来了。深度解析2017微信公开课
- 80. Remove Duplicates from Sorted Array II
- java的用户登录怎样记住上次登录的用户名和密码?
- CentOS环境PHP下安装memcache扩展
- domain unique 遇到的问题 即:@UniqueConstraint 和@indexes 用法
- 如何理解闭包
- JAVA技能包
- 继承的简单用法
- 收集的35个 jQuery 小技巧/代码片段,可以帮你快速开发.
- string类的总结
- Grafana-zabbix源码安装简要说明
- 笔记:MFC调用Python3.4