is a fantastic, open-source parallel task runner and/or job server. It is simple to implement and works across many different languages. In fact, you can call workers that run in one language from clients in another language. When scaling and parallelization become things you want to tackle, this can be a very useful feature.
Our goal behind this post isn’t to describe Gearman or tell you how great it is; it’s to cover the installation process on Ubuntu 12.04, because it can be confusing, and the Gearman page doesn’t do a great job of describing the process.
The installation is really simple though — you’ll see.
Step 1: Install Python-Software-Properties & the Gearman PPA
In case you don’t have python-software-properties installed, we will need to install it. There is also a Gearman PPA for Ubuntu, so we will add that to our repository list and do an update.
sudo apt-get install python-software-properties sudo add-apt-repository ppa:gearman-developers/ppa sudo apt-get update
Step 2: Install the Gearman Job Server & Dev Tools & Perform Upgrade
Now that we have the respository installed, let’s go ahead and install the Job Server and Tools.
This is pretty straightforward.
sudo apt-get install gearman-job-server libgearman-dev sudo apt-get upgrade
Step 3: Use PECL to Install Gearman (CLI, Client, Worker)
Using PECL, we can simply install the other needed parts of Gearman now.
sudo pecl install gearman
Step 4: Update Our php.ini (CLI and Server) to Use Gearman
Now we need to tell PHP to use the gearman.so extension. If you aren’t sure whether you will be using a web-server-based Gearman or the CLI version, you can install both to be safe. It is important to note that PHP has two separate php.ini files for CLI and Server.
For the CLI php.ini (/etc/php5/cli/php.ini)
Open your php.ini in your favorite text editor.
sudo vim /etc/php5/cli/php.ini
Add the following line in the “Dynamic Extensions” section of your php.ini.
extension=gearman.so
For the Apache-based php.ini (/etc/php5/apache2/php.ini)
Open your php.ini in your favorite text editor. Please note that this is a different file than the one we just discussed.
sudo vim /etc/php5/apache2/php.ini
Add the “Dynamic Extension” again in this file.
extension=gearman.so
Restart Apache:
sudo service apache2 restart
Step 5: Try the Examples
Now, you can try the examples found here to verify that you are all set up on Gearman.
Conclusion
Well done! After a simple and straightforward installation, you now have a fantastic task runner.
Have fun with it!




