Install Gearman PHP extension from PECL

If you have already installed Gearman Job server, now it’s time to install the PHP extension to make it usable from PHP scripts.

Gearman API

Gearman PHP Extension
The Gearman PHP extension wraps the C library installed with the Gearman C Job Server package. This provides a client and worker interface in PHP that looks much like the C interface. The PHP extension also extends the procedural interface to provide a native object oriented interface as well. This allows you to use either programming paradigm with the extension. This document will use the object oriented interface.


The Gearman PHP extension is hosted on PECL like most other extensions. Building PHP extensions assumes the PHP development package is installed (php5-dev on Ubuntu and Debian). The PHP command line interface package should also be installed for development and workers (php5-cli on Ubuntu and Debian). The tarball should be downloaded from PECL, and then to build and install run:

1. Install php-devel dependency via yum

# yum install php-devel

2. Get the latest stable build from Gearman PECL extension page. The current stable release is version 1.1.1

# wget
# tar -xzvf gearman-1.1.1.tgz
# cd gearman-1.1.1

3. Now phpize and complie it:

# phpize
# make
# make install

You will finally see something like this:

Installing shared extensions: /usr/lib64/php/modules/

4. Update PHP.INI file:

The following line will need to be added to all php.ini files, usually located in /etc/php*.


5. Restart Web server

Now restart the web server and you’re good to go:

# /etc/init.d/httpd restart

6. Test Connect:

The module should now be usable by all PHP interfaces. Call the excellent Gearman API functions for PHP now.

To test using the PHP command line interface, create gearman_version.php with the following contents:

This can then be run on the command line:

$ php gearman_version.php

You can also read the getting started guide from this page. Or if you want to install it through unix package manager you can also follow this post

Hope it’ll help someone!

Leave a reply:

Your email address will not be published.

Site Footer

Sliding Sidebar

About Me

MurshedVi Die hard coder, Unix server admin, Open source enthusiast, Localization guru, PHP expert, Apache-Solr ecosystem expert, Web geek. The wounded coder, determined not to stop before killing all bugs!! The samurai, bug hunter willing to create a bug free world for all humans!! Great Team player (always watch & cover the back of others). Extra Patience (to dig the root of every single bugs). Ultra Passionate (caring about the products I built). Perfectionist, Proactive, Collaborative, Good listener, Observer, Thinker, thoughtful to serve the better, best, awesome user experience for all netizens. Do you have a tech challenge? Drop a mail to

Oops! It looks like you haven't imported any lists yet. You must import at least one list to use the Easy MailChimp widget.