I had a pretty rough evening today. No, not because the waiter forgot to add sugar in my tea, but because it was so boring to go through the trial and errors of installing gearman daemon and pecl gearman extension for php.
First I tried with the pretty-obvious-awe-fucking-some way.
apt-get update apt-get install gearman pecl install gearman
In above steps, “apt-get install gearman” ran smoothly. But then “pecl install gearman” failed saying that it doesn’t have libgearman. Eh? so I installed libgearman4 (in Debian Squeezy. It was libgearman6 in Wheezy) and libgearman-dev. But pecl failed again to compile the extension saying that libgearman is missing. Strange! So I googled about this issue and found that it could be a link error where a symbolic link might be required of “/usr/include/libgearman” as “/usr/include/libgearman-1.0″. Still no luck.
So I decided to compile gearmand from the source. And libgearman is also included with that, so it will fix two errors at once. I downloaded the latest gearman package from launchpad and tried to compile it
wget https://launchpad.net/gearmand/1.2/1.1.11/+download/gearmand-1.1.11.tar.gz tar -zxvf gearmand-1.1.11.tar.gz cd gearmand-1.1.11 ./configure
At this step, configure stopped showing the following error
configure: error: cannot find Boost headers version >= 1.39.0
To fix this, I had to install “libboost-all-dev” by following command
apt-get install libboost-all-dev
And I tried to compile gearman and it failed again
At this step, configure stopped showing that it cannot find gperf. That’s fine – I have installed gperf and tried to configure gearman again
apt-get install gperf
Now it failed again, showing that libevent is missing. Hmm! Had to fix it anyway
apt-get install libevent-dev
Heck! Another failure. Now it’s showing that it can’t find libuuid. This part was a little tricky to solve, but finally fixed with the following package
apt-get install uuid-dev
Let’s configure again. And sweet that the configure script ran smoothly. Let’s compile using make
Grrr! At this point the make script failed with a bunch of text, where the following lines were at the top
libgearman/backtrace.cc: In function 'void custom_backtrace()': libgearman/backtrace.cc:64:6: sorry, unimplemented: Graphite loop optimizations can only be used if the libcloog-ppl0 package is installed
So it cannot find a library named libcloog-ppl. Let’s fix this problem by
apt-get install libcloog-ppl-dev
Now I’ve tried to run the make script, and it was good. So i also ran make install to complete the installation.
make make install
Now gearmand and libgearman both are installed. So I tried to install pecl-gearman with the following extension and voila! it worked. No more missing libgearman anymore.
pecl install gearman
Now all I had to do is add the line “extension=gearman.so” in my php.ini .
The process was tedious and boring and took me more time than writing this article. If you have seen “Despicable Me 2″ when Lucy and Gru went to ElMacho’s restaurant and were attacked by that crazy chicken and finally Lucy exclaimed “What’s wrong with that chicken!”
I really wanted to say “What’s wrong with this chicken” after gearman was installed at last.