日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > php >内容正文

php

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

發布時間:2024/7/5 php 38 豆豆
生活随笔 收集整理的這篇文章主要介紹了 php gearman 扩展,Ubuntu 12.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

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";

?>

測試結果:

總結

以上是生活随笔為你收集整理的php gearman 扩展,Ubuntu 12.04 安装 gearman 以及php扩展安装脚本的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。