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()

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值