一. 安装依赖环境

yum install vim wget gcc gcc-c++ make dos2unix gperf libevent 
libevent-devel zlib-devel bzip2-devel openssl-devel ncurses-devel boost 
boost-devel mysql-devel libuuid-devel gperf -y 

二. 安装

wget https://launchpadlibrarian.net/165674261/gearmand-1.1.12.tar.gz
# tar -zxvf gearmand-1.1.12.tar.gz
# cd gearmand-1.1.12
# ./configure
make && make install
ldconfig #重新加载库文件
#创建日志文件夹
mkdir -p /usr/local/var/log
#创建日志文件
touch /usr/local/var/log/gearmand.log
#启动JOB Server
gearmand -d -u root #当前用户位root时使用-u root

三. 安装PHP扩展

# wget http://pecl.php.net/get/gearman
# mv gearman gearman.tar.gz
# tar -zxvf gearman.tar.gz
# cd gearman-1.1.2/
# /usr/local/php/bin/phpize
# ./configure —with-php-config=/usr/local/php/bin/php-config
# make
# make install
将扩展添加到PHP配置文件中
echo "extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/gearman.so" 
>> /usr/local/php/etc/php.ini
# service httpd restart