zoukankan      html  css  js  c++  java
  • linux 下 php 安装 Gearman

    Gearman是一个分发任务的程序框架,它会对作业进行排队自动分配到一系列机器上。gearman跨语言跨平台,很方便的实现异步后台任务。
     
    一个Gearman请求的处理过程涉及三个角色:
    linux 下 php 安装 Gearman - 怀素真 - 因上努力 果上随缘
    Client -> Job Server -> Worker
     
    Client:请求的发起者。
    Job Server:请求的调度者,用来负责协调把Client发出的请求转发给合适的Worker。
    Worker:请求的处理者。
     
    一、安装Gearman服务端程序
    1、下载服务端程序源码包
    https://launchpad.net/gearmand/+download
    例如:gearmand-1.1.12.tar.gz
    
    2、解压程序包
    > tar zxvf gearmand-1.1.12.tar.gz
    > cd gearmand-1.1.12
    
    3、configure
    > ./configure
    (*如果出现configure: error: could not find boost)
    > yum install boost-devel
    (*如果出现configure: error: could not find gperf)
    > yum install gperf
    (*如果出现configure: error: Unable to find libevent)
    > yum install libevent-devel
    (*如果出现configure: error: Unable to find libuuid)
    > yum install libuuid-devel
    
    4、make && make install
    > make && make install
    
    5、检测是否安装成功
    > gearmand -V
    
    二、安装PHP的Gearman扩展
    1、下载扩展源码包
    https://pecl.php.net/package/gearman
    例如:gearman-1.1.2.tgz
    
    2、解压源码包
    > tar zxvf gearman-1.1.2.tgz
    > cd gearman-1.1.2
    
    3、通过phpize命令生成configure
    > /data/nmp/php/bin/phpize
    
    4、生成好后,运行configure
    > ./configure --with-php-config=/data/nmp/php/bin/php-config
    
    5、make && make install
    > make
    > make install
    
    6、如果出现如下信息,说明成功
    Installing shared extensions: /data/nmp/php/lib/php/extensions/no-debug-non-zts-20151012/
    
    7、修改php.ini
    extension_dir = "/data/nmp/php/lib/php/extensions/no-debug-non-zts-20151012/"
    extension=gearman.so
    
    8、重启服务器,查看phpinfo()
    
  • 相关阅读:
    python 项目实例
    flash教程
    flask request
    systemd-unit
    kubernets HA集群手动部署
    zookeeper(1)-简单介绍
    apache与nginx原理
    技术文章整理
    CMS垃圾回收器
    Zookeeper
  • 原文地址:https://www.cnblogs.com/jkko123/p/6294587.html
Copyright © 2011-2022 走看看