Wednesday, February 29, 2012

Installing Gearman PHP Extension 1.0.2 on Ubuntu 10.04 LTS, 11.04, 11.10 and 12.04 LTS from pecl

I started off nice and easy:
sudo apt-get install python-software-properties -y
sudo add-apt-repository ppa:gearman-developers/ppa 
sudo apt-get update
sudo apt-get install gearman-job-server libgearman-dev gearman-tools php-pear php5-dev -y
sudo apt-get install libevent-dev uuid-dev -y
pecl install gearman

Bug then I hit: configure: error: libgearman version 0.21 or later required

To fix it I needed to compile a newer gearman from source, which in turn has another couple of issues with Boost.

To fix this for Ubuntu 10.04 LTS
sudo apt-get install libboost-program-options1.40-dev libboost-thread1.40-dev -y

For Ubuntu 11.04:
sudo apt-get install libboost-thread1.42-dev libcloog-ppl0 libboost-program-options-dev -y
For Ubuntu 11.10 and 12.04:
sudo apt-get install libboost-thread1.46-dev libcloog-ppl0 libboost-program-options-dev -y

Now compile should work, in order for libgearman requirement to be met for pecl:
apt-get install uuid-dev libevent-dev -y
wget https://launchpad.net/gearmand/trunk/0.28/+download/gearmand-0.28.tar.gz
tar xfv gearmand-0.28.tar.gz
cd gearmand-0.28
./configure
make && make install
sudo ldconfig

If you want to use the newly compiled gearmand, you need to edit /etc/init.d/gearman-job-server to include /usr/local:
prefix=/usr/local
Retry pecl install and install module into php:
sudo pecl install gearman
echo "extension=gearman.so" > /etc/php5/conf.d/gearman.ini

5 comments:

  1. Jon -- thanks for this. You saved me a lot heartache here getting this installed after encountering the same difficulties you did....

    cheers, Greg H

    ReplyDelete
  2. Thanks! That worked fine, for Ubuntu 11.10 there is only one little difference install libboost-thread1.46-dev instead of 1.42

    bye!

    ReplyDelete
  3. Saved my life. Twice.

    ReplyDelete