Installing Gearman on Ubuntu 14.04

We will be tweaking the Gearman system to work with PHP. Therefore, packages will be installed to work with it and sharpen apache to work with it.

1.  We install the necessary packages:

sudo apt-get install gearman-job-server php-gearman

At this stage, there may be problems with php-gearman due to the lack of the libgearman8 package. To do this, add a PPA repository:

sudo add-apt-repository ppa:ondrej/pkg-gearman
sudo apt-get update

And repeat:

sudo apt-get install gearman-job-server php-gearman

2. PHP and Apache binding:

We need to work with phpize. To do this, install the php-dev package. In my case, I will consider php5.6.

sudo apt-get install php5.6-dev

You will also need the libgearman-dev package to use the ./configure command later.

sudo apt-get install libgearman-dev

For apache, download the latest package http://pecl.php.net/package/gearman. In my case it is gearman-1.1.2.tgz. The file ends up in the download directory /home/user/download.

cd /home/user/download
tar xzf gearman-1.1.2.tgz
cd /home/user/download/gearman-1.1.2
phpize
./configure
make
sudo make install

If everything is normal and without errors, it will display a message

Installing shared extensions:     /usr/lib/php/20131226/

This is the path to the lib, each one has its own, you need to register it in php.ini of your php version.

In my case it is:

/etc/php/5.6/apache2/php.ini

Insert at the end of the file:

; gearman
extension = /usr/lib/php/20131226/gearman.so

3. Check:

Reboot Apache:

sudo service apache2 restart

Starting the gearman service:

/etc/init.d/gearman-job-server start

In your project's php file, paste:

print gearman_version() . "\n";

If you see the gearman version and not Fatal Error, then you've done a good job.

1653 0

Comments

Be the first to review this item. Share your rating and review so that other customers can decide if this is the right item for them.
You have to log in to leave a comment. Sign in

Similar articles