Search code examples
phpgearman

PHP GearmanClient not working on Ubuntu 16.04 LTS


I have this simple code:

<?php
$client = new \GearmanClient();
$client->addServer();

This gives following error:

PHP Fatal error:  Uncaught GearmanException: Failed to set exception option in /var/www/demo-admin/public-html/admin-generico/vendor/generico/components/tests/utils/test-gearman.php:4
Stack trace:
#0 /var/www/demo-admin/public-html/admin-generico/vendor/generico/components/tests/utils/test-gearman.php(4): GearmanClient->addServer()
#1 {main}
  thrown in /var/www/demo-admin/public-html/admin-generico/vendor/generico/components/tests/utils/test-gearman.php on line 4

Gearman server is definitely running as confirmed by ps:

ps -A | grep gearman
25698 ?        00:00:00 gearmand

I installed php-gearman from ppa:ondrej/pkg-gearman

Gearman version is 1.1.17


Solution

  • The comment by @Kris Peeling gave an idea. I uninstalled everything gearman and installed again. Voila! Problem gone. I didn't have to use the localhost IP. I referred this: https://www.patreon.com/posts/gearman-now-in-14627464