Today I listened in on the O’Reilly webcast Introduction to Gearman by Eric Day of Rackspace. I thought I would follow through on the machine at hand; a Mac with OS X 10.5, however I again got caught up with the gearman PHP extension integration. A look at and older post Getting started with Gearman based on Ubuntu needed an update for Mac.
First I downloaded and installed the latest gearman. This was version 0.12 and includes libgearman 0.7.
You should always check for any more recent updates.
wget http://launchpad.net/gearmand/trunk/0.12/+download/gearmand-0.12.tar.gz tar xvfz gearmand-0.12.tar.gz cd gearmand-0.12 ./configure make sudo make install ls -l /usr/local/lib/libg* #-rwxr-xr-x 1 root wheel 79808 Mar 12 13:33 /usr/local/lib/libgearman.4.dylib #lrwxr-xr-x 1 root wheel 18 Mar 12 13:33 /usr/local/lib/libgearman.dylib -> libgearman.4.dylib #-rwxr-xr-x 1 root wheel 960 Mar 12 13:33 /usr/local/lib/libgearman.la
gearmand was installed in /usr/local/sbin and gearman installed in /usr/local/bin
Next we needed the gearman PHP extension from pecl
wget http://pecl.php.net/get/gearman-0.7.0.tgz tar xvfz gearman-0.7.0.tgz cd gearman-0.7.0 phpize ./configure make sudo make install # Installing shared extensions: /usr/lib/php/extensions/no-debug-non-zts-20060613/
Take note of the extension location, as I needed this for the next step.
Php was already installed, which was good.
$ which php /usr/bin/php
However I found no configuration loaded.
$ php --info | grep -i configuration Configuration File (php.ini) Path => /etc Loaded Configuration File => (none) Configuration
What exists is a default example only. In order to include the gearman extension I needed to do the following.
$ sudo cp /etc/php.ini.default /etc/php.ini $ sudo vi /etc/php.ini # Set extension directory extension_dir = "/usr/lib/php/extensions/no-debug-non-zts-20060613/" # Add Gearman extension extension="gearman.so"
And a confirmation.
$ php --info | egrep -i "(configuration|gearman)" Configuration File (php.ini) Path => /etc Loaded Configuration File => /private/etc/php.ini Configuration gearman gearman support => enabled libgearman version => 0.12
Ready now to try out the PHP examples.