Memcache系列(二)PHP安装memcache扩展
来源:互联网 发布:四川大学网络教育官网 编辑:程序博客网 时间:2024/06/08 14:07
在系列一中写了linux安装memcached服务;
现在写下php中如何使用
首先要给php添加memcache扩展模块
下载memcache扩展包,可以到官网进行下载,我这里下载的是memcache-3.0.8.tgz的
1. 解压tar zxvf memcache-3.0.8.tgz
2. cd memcache-3.0.8进入到解压的文件目录中
3. whereis phpize查找phpize路径;我的是在/usr/bin/phpize
执行第三步的时候报错
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
解决方案:
vi /etc/yum/pluginconf.d/fastestmirror.conf
enabled=1改成0
还有就是没有安装php-devel 安装 yum install php-devel
但是在安装php-devel中还是报错,如下图
执行 yum --enablerepo=remi,remi-php54 install php-devel 安装成功
然后就可以执行/usr/bin/phpize
4. ./configure --enable-memcache --with-php-config=/usr/bin/php-config
5. make
6. make install
安装成功后会有类似提示(这里是我安装成功的提示)
Installing shared extensions: /usr/lib64/php/modules/
然后改php.ini配置文件
在php.ini中加入以下信息
[memcache]
extension_dir = "/usr/lib64/php/modules/"
extension=memcache.so
最后重启nginx service nginx restart
重启 php-fpm service php-fpm restart
然后输出下phpinfo();就有memcache模块了
就可以在项目中使用memcache了
btw
由于一个个安装容易出错,想省事的话
service memcached start //启动
chkconfig memcached on //自动启动,防止以后重启服务器了它还要再手动启动
yum --enablerepo=remi install php-pecl-memcache //安装php的memcache扩展包
然后重启 nginx php-fpm 即可
- Memcache系列(二)PHP安装memcache扩展
- 安装 PHP Memcache 扩展
- php安装memcache扩展
- php安装memcache扩展
- php安装memcache扩展
- php安装memcache扩展
- PHP memcache扩展安装
- Memcache(MC)系列(二)Linux下Memcache安装
- PHP扩展安装memcache模块
- 安装PHP及Memcache扩展
- Linux安装php扩展memcache
- Linux安装php扩展memcache
- memcache PHP扩展安装配置
- linux php安装memcache扩展
- PHP编译安装memcache扩展
- php学习笔记(二十四)php使用memcache扩展库的使用和安装
- Memcache系列(一)Linux安装memcache
- linux(ubuntu) memcache安装及php的memcache扩展安装
- Undefined symbols for architecture armv7: "_OBJC_CLASS_$_CTTelephonyNetworkInfo", referenced from:
- 6.Python进阶_循环对象
- centos安装c编译库
- Linux进程同步之记录锁(fcntl)
- ListFragment,Fragment+ListView,ListActivity,Activity+ListView方法实现listview效果
- Memcache系列(二)PHP安装memcache扩展
- Xcode编译Undefined symbols for architecture xxx 错误总结
- CSS3 Gradient
- linux 禁止帐号密码验证 使用key验证方式登录SSH
- UITableView判断reloadData结束(iOS)
- 文件上传
- Linux线程同步之读写锁(rwlock)
- Java HashMap 的实现原理详解
- Android安全研究经验谈