首页 > 分享 > Ubuntu 12.04 安装 gearman 以及php扩展安装脚本

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

©著作权归作者所有:来自51CTO博客作者birdinroom的原创作品,如需转载,请与作者联系,否则将追究法律责任

#!/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:47301.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25.26.27.28.29.30.31.32.33.34.35.36.37.38.39.40.41.42.43.

worker.php

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

client.php

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

测试结果:

1赞 收藏 评论 举报

相关文章

相关知识

php添加openssl扩展
ubuntu安装gensim、numpy、scipy注意事项
20221126给Chrome浏览器安装扩展程序——猫抓
ubuntu16.04安装opencv3.4.1时出现: libgtk2.0
windows上psycopg2安装过程
【壁挂炉安装方法】壁挂炉安装示意图 壁挂炉如何安装?
NPM安装模块报错:Error: sha1
在单个服务器上安装多个Elasticsearch节点
VS Code Pets 安装与配置完全指南
(php毕业设计源码)基于php宠物爱好者交流平台管理系统

网址: Ubuntu 12.04 安装 gearman 以及php扩展安装脚本 https://m.mcbbbk.com/newsview622941.html

所属分类:萌宠日常
上一篇: 广州“城市客厅”花城广场海心沙—
下一篇: 中国梦优秀网络节目展播云南·鸟乐