I am getting some trouble obtaining the PHP Imagick extension put together and running with XAMPP 1.7.3 on OS X Lion.

I recieve the next error during my PHP error log when starting Apache (and also the extension does not show within the phpinfo() output):

[16-Aug-2011 12:42:31] PHP Warning:  PHP Startup: Unable to load dynamic library '/Applications/XAMPP/xamppfiles/lib/php/php-5.3.1/extensions/no-debug-non-zts-20090626/imagick.so' - dlopen(/Applications/XAMPP/xamppfiles/lib/php/php-5.3.1/extensions/no-debug-non-zts-20090626/imagick.so, 9): no suitable image found.  Did find:
    /Applications/XAMPP/xamppfiles/lib/php/php-5.3.1/extensions/no-debug-non-zts-20090626/imagick.so: mach-o, but wrong architecture in Unknown on line 0

I installed the XAMPP development package.

I made use of Homebrew to set up Imagick 6.7.1-1:

brew install imagemagick
brew link imagemagick

To set up the Imagick extension I made use of PECL supplied with XAMPP:

cd /Applications/XAMPP/xamppfiles/bin
sudo ./pecl install imagick

When motivated for that location of ImageMagick I have attempted the next pathways (with similar result):

/usr/local/bin
/usr/local/Cellar

You can observe the whole output here: https://gist.github.com/1149849

Furthermore I attempted getting the Imagick PECL (3..one and three.1.0b) tar in the PECL website and producing on your own:

/Application/XAMPP/xamppfiles/bin.phpize
./configure --with-imagick=/usr/local/bin --with-php-config=/Applications/XAMPP/xamppfiles/bin/php-config-5.3.1 
make
sudo make install
make test

You can observe the output here: https://gist.github.com/1149875

I have happened across a couple of articles relating to this subject on various website, none which have assisted me resolve it.

I have also attempted MacPorts for ImageMagic, with similar result (using /opt/local because the path throughout compile).

Any advice could be greatly appreciated.

Note: For that record, I am in a position to reproduce this problem on another OS X Lion machine.

PHP Warning: PHP Startup: Unable to load dynamic library '../imagick.so' {Snip}....no suitable image found. Did find: imagick.so: mach-o, but wrong architecture in Unknown on line 0

It clearly states, the extension can there be but architecture isn't same your kernel. possibly you're kicked into 64bit kernel &lifier attempting to run 32version or the other way around.

Just boot into kernel with correct arch

[1] Mac OS X v10.6: Starting up with the 32-bit or 64-bit kernel