Installing the oAuth pecl extension on Mac OS X with Zend Server Community Edition

I’m running Zend Server Community Edition on Mac OS X. I attempted to install the PECL oAuth extension by using the simple command:

sudo pecl install oauth

The installation went fine, but when I attempted to find pecl in my modules list, it wasn’t present. When I checked /usr/local/zend/var/log/php.log, I got the following error message:

[11-Jul-2011 00:19:32] PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/zend/lib/php_extensions/oauth.so' - dlopen(/usr/local/zend/lib/php_extensions/oauth.so, 9): no suitable image found.  Did find:
/usr/local/zend/lib/php_extensions/oauth.so: mach-o, but wrong architecture in Unknown on line 0

It turns out the reason for this is that Snow Leopard builds the pecl extension, it’s doing so as a 64-bit binary. However, Zend Server community edition is compiled using 32-bit. I found a blog post which explains exactly how to compile the PECL module. The solution worked out perfectly.