CentOS 5.8 x64 安装 Gearmand 和 Gearman php扩展

 1.首先下载所需软件

 
wget https://github.com/downloads/libevent/libevent/libevent-2.0.20-stable.tar.gz 
 
wget http://sourceforge.net/projects/re2c/files/re2c/0.13.5/re2c-0.13.5.tar.gz/download
 
wget https://launchpad.net/gearmand/1.2/1.1.6/+download/gearmand-1.1.6.tar.gz
 
wget http://pecl.php.net/get/gearman-1.1.1.tgz
 
wget http://ncu.dl.sourceforge.net/project/boost/boost/1.53.0/boost_1_53_0.zip
 
 
 
2.安装编译软件
 
 
tar zxvf libevent-2.0.20-stable.tar.gz
cd libevent-2.0.20-stable
./configure --prefix=/usr 
make
make install
/sbin/ldconfig
 
 
 
unzip boost_1_53_0.zip
cd boost_1_53_0 
./bootstrap.sh --prefix=/opt/local/boost-1.53
 
 
vi tools/build/v2/user-config.jam
 
             在最后增加
using mpi 
 
./b2
./b2 install
 
 
 
tar zxvf gearmand-1.1.6.tar.gz
cd gearmand-1.1.6
./configure --with-boost=/opt/local/boost-1.53
make 
make install
/sbin/ldconfig
 
 
 
 
tar -zxvf re2c-0.13.5.tar.gz
cd re2c-0.13.5
./configure 
make 
make install
 
 
 
tar zxvf gearman-1.1.1.tgz
cd gearman-1.1.1
/opt/local/php/bin/phpize
./configure --with-php-config=/opt/local/php/bin/php-config --with-gearman
make
make install
 
 
3. 编辑 php.ini
 
 
vi php.ini
 
增加
 
extension = "gearman.so"
 
 
重启php
 
 
 
 
 
4. 启动 gearmand 服务
 
gearmand -L 10.6.0.6 -p 4730  -u root -l /var/log/gearmand.log -d 
 
其他参数请  gearmand --help
 
 
 
 
 
 
5. 一个监控的工具
 
wget https://nodeload.github.com/yugene/Gearman-Monitor/zip/master
 
 
ps: 
错误.1
 
error: tr1/cinttypes: No such file or directory
 
yum install gcc44 gcc44-c++ libstdc++44-devel
 
export CC="gcc44"
export CXX="g++44"
 
 
错误.2
configure: error: Please install libgearman 
 
export GEARMAN_LIB_DIR=/usr/include/libgearman 
export GEARMAN_INC_DIR=/usr/include/libgearman
 
 
 
错误.3
libhostile/function.c: In function 'print_function_cache_usage':
libhostile/function.c:54: error: 'for' loop initial declarations are only allowed in C99 mode
libhostile/function.c:54: note: use option -std=c99 or -std=gnu99 to compile your code
 
 
 
 
那是因为 C++ 默认是用 c89 来编译的···需要更改成 c99 编译!
 
./configure 以后
 
vim Makefile
 
搜搜 CC
 
这里更改为
 
CC = gcc44 -std=c99
 
-------------------------------------------------------------------------------------
 
 
 
错误.4
 
collect2: ld returned 1 exit status   
make[1]: *** [benchmark/blobslap_worker] Error 1
 
 
GOOGLE 解决办法 
 
cd /opt/local/boost-1.53/lib  
cp -rf * /usr/lib/;  
cp -rf * /usr/lib64/;  
ln -s /opt/local/boost-1.53/include/boost /usr/include/boost 
 
 
 
 
 
 
 
-------------------------------------------------------------------------------------
 
 
错误.5
 
gearmand   make 出现 sqlite3  的错误.. 找不到解决办法~只能在configure 里把 sqlite3 先关闭掉...
 
./configure --with-boost=/opt/local/boost-1.53 --with-sqlite3=no

你可能感兴趣的:(PHP扩展,gearman)