JSGarcia
JSGarcia

Reputation: 566

Gearman & PHP: 'Failed to set exception option'

I just deploy gearman on a server with CentOS7 installed. I use gearman through PHP, I have also installed the library 'libgearman'.

When I run my PHP script, which was running on another server correctly, I get the following error when adding the gearman server:

Fatal error: Uncaught exception 'GearmanException' with message 'Failed to set exception option' in /var/www/html/dev1/index.php:9 Stack trace: #0 /var/www/html/dev1/index.php(9): GearmanClient->addServer('127.0.0.1', 4730) #1 {main} thrown in /var/www/html/dev1/index.php on line 9

I've reading that this error usually occurs because versions of the Gearman server and libgearman are diferentres or the gearmand server is stopped.

I have verified that the versions are the same and the server is running, but this message still appears.

Gearmand version

[root@localhost integracion]# gearadmin --server-version
1.1.12

Libgearman version

Libgearman version

PHP version

[root@localhost integracion]# php -v
PHP 5.4.16 (cli) (built: Jun 23 2015 21:17:27)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies

HTTPD version

[root@localhost integracion]# httpd -v Server version: Apache/2.4.6 (CentOS)
Server built:   Nov 19 2015 21:43:13

PHP script

<?php

# Se crea el objeto cliente
$gmclient= new GearmanClient();

# Se añade el servidor por defecto (localhost).
$gmclient->addServer("127.0.0.1", 4730);

?>

Gearmand Log File

[root@localhost log]# tail gearmand.log
 NOTICE SIGHUP, reopening log file
  ERROR 2016-03-21 10:25:57.000000 [  main ] poll(Interrupted system call) -> libgearman-server/timer.cc:77
  ERROR 2016-03-22 10:06:10.000000 [  main ] Timeout occured when calling bind() for 0.0.0.0:4730 -> libgearman-server/gearmand.cc:688

Can anybody help me? Thank you!

Upvotes: 1

Views: 5798

Answers (2)

Kyle Anderson
Kyle Anderson

Reputation: 1880

The following fixed this error for me on Ubuntu 16.04

1) see https://github.com/gearman/gearmand/releases

2) install latest version (for me it was 1.1.17)

sudo apt-get install gcc autoconf bison flex libtool make libboost-all-dev libcurl4-openssl-dev curl libevent-dev memcached uuid-dev libsqlite3-dev libmysqlclient-dev gperf
sudo apt-get install libmysqld-dev
cd /usr/local/src/
sudo wget https://github.com/gearman/gearmand/releases/download/1.1.17/gearmand-1.1.17.tar.gz
cd gearmand-1.1.17/
sudo ./configure
sudo make
sudo make install
sudo service gearman-job-server restart

Upvotes: 1

guest_aaa
guest_aaa

Reputation: 31

First find your gearman installation path ep:/usr/local/gearman/. Start gearmand: /usr/local/gearman/sbin/gearmand -d And then,run your PHP script.

Upvotes: 3

Related Questions