Skip to content

Instantly share code, notes, and snippets.

Last active January 5, 2023 07:58
Show Gist options
  • Star 22 You must be signed in to star a gist
  • Fork 10 You must be signed in to fork a gist
  • Save mnapoli/5270256 to your computer and use it in GitHub Desktop.
Save mnapoli/5270256 to your computer and use it in GitHub Desktop.
Installing Gearman on windows

Gearman can be installed on Windows through cygwin.

Install Cygwin packages

Install cygwin packages (through setup.exe):

  • gcc
  • make
  • libuuid1-devel
  • libiconv
  • boost
  • libboost-devel
  • libmpfr4

Install libevent

Download and unpack libevent 1.4 sources (to a directory without spaces, e.g. C:\cygwin\tmp), then run:

cd libevent-1.4.14b-stable
make install

Now libevent should be installed on /usr/local/lib, but this path is not in the library path and GCC will not find it automatically.

You can copy the generated libraries to /usr/lib:

cp /usr/local/lib/libevent* /usr/lib

(this is not the cleanest solution, you are welcome to propose an alternative)

Install Gearman

Download gearmand C server sources (to a directory without spaces, e.g. C:\cygwin\tmp). Attention, because of this bug you can' install a version higher than V0.14. Here is a direct link to download V0.14.


cd gearmand-0.14
make install

Now the server is installed and you can launch it from a cygwin terminal:


Or if you want it to be ultra verbose:

/usr/local/sbin/gearmand.exe -vvv

You can also start the process and detach it from the terminal:

gearmand -d


Open 3 terminals.

In the 1st, start the Gearman server:


In the 2nd, start a worker:

gearman -w -f wc -- wc -l

In the 3rd, send a task to the Gearman server. It will be dispatched to the worker which will process it and return the result to the server, which will return it to you 3rd terminal.

gearman -f wc < /etc/passwd
Copy link

Thanks pal. You saved my chops.

Copy link

Thank you very much for this!

Copy link

my question is how we can work with windows. What changes will required in PHP.ini file?

which DLL is required?

Copy link

When I start gearmand.exe, i got these errors:
ERROR 2015-03-11 19:53:19.997184 [ main ] pthread_attr_setscope(Not supported) -> libgearman-server/
FATAL 2015-03-11 19:53:19.997184 [ main ] gearman_server_thread_init(NULL) -> libgearman-server/
ERROR 2015-03-11 19:53:20.012784 [ main ] poll(Bad file descriptor) -> libgearman-server/
Do you know how to fix that?

Copy link

yairpe commented Apr 24, 2015

Thank you. Even now, two years later, and one cannot deploy the latest gearmand on Windows.....

I spent almost two days trying to tweak and solve compilation issues with the current 0.41 version, and eventually had to use the old 0.14 version just to make it work.

I would suggest others to do the same or maybe install the Java version of the server and use it with PHP.

Why do I need gearman on windows? simple. I develop on windows and deploy on Unix.

Thanks again

Copy link

In my case is the other way around, develop on mac and deploy to Windows "yuck"... having a go installing latest version of gearman 1.1.12 on Windows Server 2012. Will let you guys know if I succeed... fingers crossed.

Copy link

@yairpe, which dll are you using? I am running the server with java, but I do not have the PHP extension to connect.

Copy link

Hi, thanks for this tutorial, i have installed gearman on windows but I'm unable to use this on my php script getting Fatal error: Class 'GearmanClient' not found'. any help? thanks in advance!

I'm asking like @vguptabpl

Copy link

Thanks, worked like a charm! Just for the records, in the latest versions of cygwin you can install libevent, so you don't need to download and compile it manually.

Copy link

Thanks, I followed these steps. But I have one doubt what is gearmand? is it same as gearman? I am a beginer, sorry for this stupid question

Copy link

thongvo commented Apr 7, 2016

This location didn't exist on Windows.

Copy link

Hi ,
I followed the steps as per given above . but when I try to run the gearman command its give me error $ gearmand -d
-bash: gearmand: command not found.Kindly help me out

Copy link

when i try to install libevent-2.1.8-stable
this error will occur
$ ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... no
checking whether make supports nested variables... no
checking whether make supports nested variables... (cached) no
checking for style of include used by make... none
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in /tmp/libevent-2.1.8-stable': configure: error: no acceptable C compiler found in $PATH See config.log' for more details

Copy link

lexandr commented Sep 26, 2017

Here is the compiled version of gearmand for windows

Copy link

ivanzor commented Jan 21, 2019

Fatal error: Class 'GearmanWorker' not found'. any help? thanks in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment