Installing/Configuring

Tags

  • Use last unstable version ( alias of dev-master ) to stay always in last commit
  • Use last stable version tag to stay in a stable release.
  • LatestUnstableVersion LatestStableVersion

Installing Gearman

To install Gearman Job Server with apt-get use the following commands:

$ sudo apt-get install gearman-job-server

And start server

$ service gearman-job-server start

Then you need to install Gearman driver using the following commands:

  • for PHP 5.x
$ pecl install channel://pecl.php.net/gearman
  • for PHP 7
$ curl -L -o gearman.tgz https://github.com/wcgallego/pecl-gearman/archive/gearman-2.0.1.tar.gz
$ tar -xzf gearman.tgz
$ cd pecl-gearman-gearman-2.0.1 && phpize && ./configure && make && sudo make install

You will find all available gearman versions in Pear Repository Finally you need to start php module if it’s not already made

$ echo "extension=gearman.so" > /etc/php5/conf.d/gearman.ini

Installing GearmanBundle

You have to add require line into you composer.json file

"require": {
   "mikaelkael/gearman-bundle": "dev-master"
}

Then you have to use composer to update your project dependencies

$ curl -sS https://getcomposer.org/installer | php
$ php composer.phar update

Register the GearmanBundle annotations in app/autoload.php

<?php
// app/autoload.php
AnnotationRegistry::registerFile(
    $kernel->locateResource(__DIR__ . '/../vendor/mikaelkael/GearmanBundle/Driver/Gearman/Work.php')
);
AnnotationRegistry::registerFile(
    $kernel->locateResource(__DIR__ . '/../vendor/mikaelkael/GearmanBundle/Driver/Gearman/Job.php')
);

And register the bundle in your appkernel.php file

return array(
   // ...
   new Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle(),
   new Mkk\GearmanBundle\GearmanBundle(),
   // ...
);