Gearman is an open source generic framework for distributed processing. At OSCON 2009 I attended the Gearman: Build Your Own Distributed Platform in 3 Hours tutorial.
While it’s very easy to install Gearman, and follow the first example, if you missed the all important additional PHP steps listed on just one slide you may be left with the “‘Class ‘GearmanClient’ not found” error.
The following are detailed instructions for the installation and configuration of Gearman and PHP on Ubuntu 9.04 Jaunty.
Add the Drizzle PPA to get pre-packaged versions of Gearman.
cp /etc/apt/sources.list /etc/apt/sources.list.orig echo "deb http://ppa.launchpad.net/drizzle-developers/ppa/ubuntu intrepid main deb-src http://ppa.launchpad.net/drizzle-developers/ppa/ubuntu intrepid main" >> /etc/apt/sources.list apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 06899068 apt-get update
Get the gearman packages
apt-get install -y gearman gearman-job-server gearman-tools libgearman1 libgearman-dev libgearman-dbg libgearman-doc
Get the German PHP extension.
wget http://pecl.php.net/get/gearman-0.4.0.tgz tar xvfz gearman-0.4.0.tgz cd gearman-0.4.0/ phpize ./configure make make install
If phpize is not available then you are missing the development packages.
$ apt get php5-dev
You also configure PHP to load the extension. This will vary on different Linux environments. In this case.
echo 'extension="gearman.so"' >>/etc/php5/cli/php.ini
Verify the PHP Gearman extension is configured.
$ php --info | grep gearman gearman gearman support => enabled libgearman version => 0.8
Now you are ready for working with the Gearman PHP examples.