linux 编译PHP memcache扩展
在Linux下编译memcache:
memcache官网:http://memcached.org/
前期准备:
如果是虚拟机 保证虚拟机 联网
安装依赖包
yum -y install gcc make libtool autoconf
编译libevent(官网:http://libevent.org/ memcache编译需要用到这个东西)
cd /usr/local/src
wget https://github.com/libevent/libevent/releases/download/release-2.1.8-stable/libevent-2.1.8-stable.tar.gz
注意:源码包的地址为https 的 。在虚拟机中可能下载不了 我们只需要在这行命令后面加一个参数
--no-check-certificate 就ok了
tar -zxvf libevent-2.1.8-stable.tar.gz //解压
cd libevent-2.1.8-stable //进入解压目录
./configure --prefix=/usr/local/libevent //编译
make&&make install //安装
编译memcache:
cd /usr/local/src
wget http://www.memcached.org/files/memcached-1.5.12.tar.gz
tar -zxvf memcached-1.5.12.tar.gz
cd memcache-1.5.12
./configure --prefix=/usr/local/memcache --with-libevent=/usr/local/libevent/
make && make install
启动memcache
注意不能以root用户进行启动 要用一个其他的用户 哪个都可以 用参数 -u 设置
让memcache 在后台启动 使用参数 -d表示
linux PHP编译memcache扩展:
php 扩展官网:http://pecl.php.net 搜索memcache 找到php memcache的扩展包
wget http://pecl.php.net/get/memcache-2.2.7.tgz
tar -zxvf memcache-2.2.7.tgz
cd cd memcache-2.2.7
//通过phpize 动态的创建适合本地环境的扩展编译脚本 (configure) 无论装什么扩展都是一样的 安装之前首先要明确phpize php-config两个文件的位置 如果不知道 可以通过 find / -name 'phpize' find / -name 'php-config' 命令来进行查找
/phpstudy/server/php/bin/phpize --with-php-config=/phpstudy/server/php/bin/php-config
./configure --with-php-config=/phpstudy/server/php/bin/php-config
make && make install
//安装成功之后 会出现 类似如下字样的路径:将此路径进行拷贝 然后查看此路径下面有没有 .so的扩展文件
//验证是否生成扩展文件 memcache.so
ls /phpstudy/server/php/lib/php/extensions/no-debug-non-zts-20121212/
//修改php.ini
添加:
extension=/phpstudy/server/php/lib/php/extensions/no-debug-non-zts-20121212/memcache.so
虚拟机环境 安装 php7memcache扩展:
wget https://github.com/websupport-sk/pecl-memcache/archive/php7.zip
unzip pecl-memcache-php7.zip
cd pecl-memcache-php7
/usr/local/php/bin/phpize --with-php-config=/usr/local/php/bin/php-config
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install
修改php.ini
最新文章
- 12月4日PHPCMS模板
- Android AlertDialog去除黑边白边自定义布局(转)
- 【分享】国外后台界面HTML源码 [免费]
- FireFox每次访问页面时检查最新版本
- lkx开发日志2-第一次团队讨论
- WIN7无法记住远程登录密码
- SPOJ REPEATS 后缀数组
- 使用原生Sql查询实现按分类推送最新文章到首页
- Jmail组件发送邮件说明ASP.NET
- hud 2549 壮志难酬
- 【JAVA零基础入门系列】Day6 Java字符串
- 网页窗口logo图标设置
- webapi从入门到放弃(一)OWIN 自寄宿模式
- 虚拟机中linux系统的安装教程
- (Review cs231n) CNN in Practice
- 错误:软件包:3:docker-ce-18.09.4-3.el7.x86_64 (docker-ce-stable) 需要:container-selinux >;= 2.9
- python实战学习之numpy学习
- [CodeForces - 447E] E - DZY Loves Fibonacci Numbers
- java在注解中绑定方法参数的解决方案
- FireDACQuery FDQuery New