How to install Gearman for PHP on OS X

Setup Gearman for PHP with OS X 10.9.2 Mavericks using brew. This requires libgearman and the easiest way to get it is probably to install gearman through brew, of course.

It might also be worth noting that this works for me with the brew build of PHP. It will probably work for the distribution that comes with OS X but I haven’t tested.

sudo pecl install gearman

Next copy the following contents into /usr/local/etc/php/5.4/conf.d/ext-gearman.ini (or wherever your extension config directory is):

[gearman]
extension="/usr/local/Cellar/php54/5.4.13/lib/php/extensions/no-debug-non-zts-20100525/gearman.so"

Restart apache:

sudo apachectl restart

That’s it. Test to make sure it’s loaded with phpinfo.

Apr 23, 2014 Programming