zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    GetHub下载不成功
    Cache 判断Ip几分钟内攻击次数
    .net 通过Url获取站点json数据
    Linq 读取Xml 数据
    ef Linq 自定义字段列表
    面试的心得
    触发器--单独字段变化另一个字段也变化
    Ajax跨域 取值 Jsonp的定义注意事项
    asp.net里,各种下载方式汇总
    c# 获取硬件信息
  • 原文地址:https://www.cnblogs.com/dream98/p/10620910.html
Copyright © 2011-2022 走看看