Ubuntu12.04安装gearman以及php扩展安装脚本-创新互联

成都创新互联公司是一家集网站建设,大连企业网站建设,大连品牌网站建设,网站定制,大连网站建设报价,网络营销,网络优化,大连网站推广为一体的创新建站企业,帮助传统企业提升企业形象加强企业竞争力。可充分满足这一群体相比中小企业更为丰富、高端、多元的互联网需求。同时我们时刻保持专业、时尚、前沿,时刻以成就客户成长自我,坚持不断学习、思考、沉淀、净化自己,让我们为更多的企业打造出实用型网站。#!/usr/bash #create by lhb #date 2014-05-07 #desc install gearman and php extension for Ubuntu 12.04.4 LTS PHP 5.5 apt-get update #安装依赖库 apt-get install libboost-all-dev gperf libevent1-dev libcloog-ppl0 mkdir -pv /home/lhb/software && cd /home/lhb/software #下载gearman包 wget https://launchpad.net/gearmand/1.2/1.1.8/+download/gearmand-1.1.8.tar.gz tar zxvf gearmand-1.1.8.tar.gz cd gearmand-1.1.8/ ./configure make make install cd .. apt-get install gearman-job-server service gearman-job-server start ps -ef |grep gearman #安装php5-fpm apt-get install php5-fpm php-cli php5-cli php5-dev #下载gearman的php扩展库 wget http://pecl.php.net/get/gearman-1.1.2.tgz tar zxvf gearman-1.1.2.tgz cd gearman-1.1.2/ phpize whereis php-config ./configure --with-php-config=/usr/bin/php-config make make install #加入到php.ini配置 echo "extension=gearman.so" > /etc/php5/mods-available/gearman.ini #cd /etc/php5/cli/conf.d/ && ln -s ../../mods-available/gearman.ini gearman.ini #cd /etc/php5/fpm/conf.d/ && ln -s ../../mods-available/gearman.ini gearman.ini for target_path in /etc/php5/cli/conf.d/ /etc/php5/fpm/conf.d/ ; do cd $target_path && ln -s ../../mods-available/gearman.ini gearman.ini done service php5-fpm restart #查看扩展是否安装成功 php --info | grep "gearman" 查看是否启动 ps auxw | grep [g]earmand lsof -i tcp:4730

Ubuntu 12.04 安装 gearman 以及php扩展安装脚本

Ubuntu 12.04 安装 gearman 以及php扩展安装脚本

worker.php

addServer(); $worker->addFunction("lhb", "lhb_test"); while ($worker->work()); function lhb_test($job) { return strtoupper($job->workload()); } ?>

client.php

addServer(); print $client->do("lhb", "this is a test by lhb"); print "\n"; ?>

测试结果:

Ubuntu 12.04 安装 gearman 以及php扩展安装脚本

另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


新闻名称:Ubuntu12.04安装gearman以及php扩展安装脚本-创新互联
本文网址:http://scyanting.com/article/cehcod.html