分佈式計算框架Gearman和PHP Gearman擴展安裝流程

1、安裝包
Gearman下載地址(C語言版):
https://launchpad.net/gearmand
PHP Gearman擴展下載地址:
http://pecl.php.net/get/gearman-1.1.0.tgzphp


2、安裝流程
一、源代碼編譯安裝Gearman(與ubuntu安裝任選其一):
tar zxf gearmand-1.1.1.tar.gz
cd gearmand-1.1.1/
./configure --prefix=/usr/local/gearman
make
make install
/sbin/ldconfig
cd ../
二、ubuntu 安裝Gearman(與源代碼安裝任選其一):
ubuntu apt-get install gearman-job-server
三、安裝PHP Gearman擴展:
tar zxf gearman-1.1.0.tgz
cd gearman-1.1.0/
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config --with-gearman=/usr/local/gearman
make
make install
cd ../ubuntu


3、啓動Gearman
/usr/local/gearman/sbin/gearmand --daemon --listen=127.0.0.1 --port=4730 --pid-file=/var/run/gearman/gearmand.pid --log-file=/data/logs/gearman/gearman.log
(編譯安裝啓動腳本,ubuntu安裝會默認啓動)ui


4、安裝過程當中出現的問題
一、安裝Gearman:
(1)configure時報錯
configure: error: cannot find Boost headers version >= 1.39.0
要安裝:
apt-get install libboost-program-options-dev
(2)configure: error: cannot find the flags to link with Boost thread
要安裝:tar
apt-get install libboost-thread-dev
(3)configure: error: Unable to find libevent
要安裝:
apt-get install libevent-dev
(4)fatal error: uuid/uuid.h: No such file or directory
compilation terminated.
要安裝:
apt-get install uuid-dev
(5)can only be used if the libcloog-ppl0 package is installed
要安裝:
apt-get install libcloog-ppl0
(6) 若是configure或make時報錯:
apt-get install libboost-program-options-dev  libboost-thread-dev libevent-dev uuid-dev libcloog-ppl0spa


二、安裝PHP Gearman擴展
一、若是出現錯誤,能夠在configure時指定"--with-gearman=",讓php找到適合的libgearman
二、若是出現"[php_gearman.lo] Error 1"錯誤, 能夠將"php_gearman.loT" 拷貝一個 "php_gearman.lo",而後再make
三、若是啓動php的時候gearman.so無效,則gearman擴展版本要到1.1.0版本才行.net

 

PHP7 參照https://yq.aliyun.com/articles/601310server

相關文章
相關標籤/搜索