1.安裝依賴庫php
$ sudo apt-get install libboost-dev libboost-all-dev gperf* libevent-dev $ wget http://nchc.dl.sourceforge.net/project/libuuid/libuuid-1.0.3.tar.gz $ tar zxvf libuuid-1.0.3.tar.gz $ cd libuuid-1.0.3/ $ ./configure $ sudo make $ sudo make install
2.安裝 gearmand(主要是想安裝 libgearman,安裝 PHP 擴展時依賴它)apache
$ wget https://launchpad.net/gearmand/1.2/1.1.12/+download/gearmand-1.1.12.tar.gz $ tar zxvf gearmand-1.1.12.tar.gz $ cd gearmand-1.1.12/ $ ./configure $ sudo make clean $ sudo make $ sudo make install $ sudo /sbin/ldconfig
3.安裝 PHP 的 Gearman 擴展bash
$ wget http://pecl.php.net/get/gearman-1.1.2.tgz $ tar zxvf gearman-1.1.2.tgz $ cd gearman-1.1.2/ $ sudo phpize $ sudo ./configure $ sudo make $ sudo make install $ sudo echo "extension=gearman.so" >> /etc/php/5.6/apache2/php.ini $ sudo /etc/init.d/apache2 restart
注意:若是隻安裝 php 的 gearman 擴展,進行編譯時報錯:configure: error: Please install libgearman 可是卻找不到 libgearman 的源碼包下載地址。其實 gearmand 裏是包含 libgearman 的,因此想要安裝 php 的 gearman 擴展,則必須先安裝 gearmand 。ui