Ubuntu 12.04 安装 gearman 以及php扩展安装脚本(gearman php shell,ubuntu 12.04,un,web开发)

时间:2024-05-06 10:52:18 作者 : 石家庄SEO 分类 : web开发
  • TAG :


#!/usr/bash#create by lhb#date 2014-05-07#desc install gearman and php extension for Ubuntu 12.04.4 LTS PHP 5.5apt-get update#安装依赖库apt-get install libboost-all-dev gperf libevent1-dev libcloog-ppl0mkdir -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.gztar zxvf gearmand-1.1.8.tar.gzcd gearmand-1.1.8/./configuremakemake installcd ..apt-get install gearman-job-serverservice gearman-job-server startps -ef |grep gearman#安装php5-fpmapt-get install php5-fpm php-cli php5-cli php5-dev#下载gearman的php扩展库wget http://pecl.php.net/get/gearman-1.1.2.tgztar zxvf gearman-1.1.2.tgzcd gearman-1.1.2/phpizewhereis php-config./configure --with-php-config=/usr/bin/php-configmakemake 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.inifor target_path in /etc/php5/cli/conf.d/ /etc/php5/fpm/conf.d/ ; do cd $target_path && ln -s ../../mods-available/gearman.ini gearman.inidoneservice php5-fpm restart#查看扩展是否安装成功php --info | grep "gearman"查看是否启动ps auxw | grep [g]earmandlsof -i tcp:4730


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


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


worker.php

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


client.php

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


测试结果:

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


 </div> <div class="zixun-tj-product adv-bottom"></div> </div> </div> <div class="prve-next-news">
本文:Ubuntu 12.04 安装 gearman 以及php扩展安装脚本的详细内容,希望对您有所帮助,信息来源于网络。
上一篇:复习PHP-语言参考-预定义接口下一篇:

10 人围观 / 0 条评论 ↓快速评论↓

(必须)

(必须,保密)

阿狸1 阿狸2 阿狸3 阿狸4 阿狸5 阿狸6 阿狸7 阿狸8 阿狸9 阿狸10 阿狸11 阿狸12 阿狸13 阿狸14 阿狸15 阿狸16 阿狸17 阿狸18