imagick OSX 10.7 (Lion) Unable to load dynamic library

Problems with the Mac OS X version of XAMPP, questions, comments, and anything related.

imagick OSX 10.7 (Lion) Unable to load dynamic library

Postby promovi » 04. December 2011 08:36

Hello,

I'm relatively new to Unix, specifically the OSX flavor of Unix, so I'm trying to learn. My basic goal is to get the imagick extension working in my XAMPP PHP environment. I have googled and googled and I'm almost there, I'm just having, what I believe, to be one more stumbling block. When I start Apache, I get the following error in the log file:

Code: Select all
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:\n\t/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


After googling around I found out that what could be going on is that I'm building the imagick.so file as 32-bit when my OS/computer is running at 64-bit. I believe I've tried to compile with both bit depths, but doing so doesn't seem to change anything, although I may be doing it wrong.

I'm wondering if anybody out there has any idea how to make this work. Below are the steps I took in order to get as far as I am. Please help. Thanks!

(I started by following http://benford.bluhelix.com/installing-imagemagick-php-libraries-on-macos-with-xampp/ but soon hit road blocks and eventually have pieced together the instructions below.)

1. Install XAMPP and the XAMPP Developer Package. (I was frustrated by the lack of the developer package for a few nights.)


2. Install and update MacPorts.
After installed, type
Code: Select all
sudo port -v selfupdate
and
Code: Select all
sudo port upgrade outdated
into the terminal.


3. Made sure that
Code: Select all
/opt/local/bin
and the path to your xampp bin folder, mine is
Code: Select all
/Applications/XAMPP/xamppfiles/bin
was a part of my .profile $PATH variable. When you are done, your $PATH variable should look something similar to
Code: Select all
/opt/local/bin:/opt/local/sbin:/Applications/XAMPP/xamppfiles/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
. To view your path variable type
Code: Select all
echo $PATH
. Note: The XAMPP path will give you global terminal access to PECL.

To find, type
Code: Select all
cd
in at the terminal and this will take you to the current user's home directory. Then type
Code: Select all
ls -a
to see all the files. Open and edit .profile using
Code: Select all
vi .profile
. If you don't know how to use vi, look here: http://www.cs.colostate.edu/helpdocs/vi.html .

Be sure to reload your profile in your terminal by typing
Code: Select all
. ./.profile



4. Install Image Magick using MacPorts by typing
Code: Select all
sudo port install ImageMagick
into the terminal.


5. Download the imagick PHP extention using PECL by typing in
Code: Select all
sudo pecl download imagick
into the terminal.


6. Decompress the resultant imagick file that was downloaded. It will be downloaded into whatever directory you're currently in at your terminal. To determine this, type in
Code: Select all
pwd
into the terminal. (pwd = present working directory). You can either decompress this by using Finder to double click, or use the terminal and type in
Code: Select all
sudo tar -zxvf imagick-[i]versionnumber[/i].tar
. For me, it was imagick-3.0.1.tar.


7. Go into the resultant folder that was decompressed and perform the following commands:
Code: Select all
sudo phpize

Code: Select all
sudo ./configure --with-imagick=/opt/local --with-php-config=/applications/xampp/xamppfiles/bin/php-config
Note: you may need to change your path to XAMPP PHP-config
Code: Select all
sudo make

Code: Select all
sudo make install



8. Check to make sure the imagick.so file is in the PHP extensions folder. In my case this was
Code: Select all
/applications/xampp/xamppfiles/lib/php/php-5.3.1/extensions/no-debug-non-zts-20090626



9. Open XAMPP php.ini file and under the extensions area (you know it when you see it) add a new line with
Code: Select all
extension=imagick.so



10. Stop and restart Apache. You should see imagick in the phpinfo() lineup. (currently I don't. Instead I see the error in my log.)


Please help! Thanks!
promovi
 
Posts: 2
Joined: 04. December 2011 08:04
Operating System: OSX 10.7 (Lion)

Re: imagick OSX 10.7 (Lion) Unable to load dynamic library

Postby JonB » 04. December 2011 12:48

Although you went to great details - I'm a bit lost -

Are you saying that after your best efforts - this is the error message you are left with:

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:\n\t/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


Thanks -
8)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: imagick OSX 10.7 (Lion) Unable to load dynamic library

Postby promovi » 04. December 2011 16:24

Correct! After doing steps 1 through 10 I end up with the unable to load dynamic library error you stated. Any ideas?
promovi
 
Posts: 2
Joined: 04. December 2011 08:04
Operating System: OSX 10.7 (Lion)

Re: imagick OSX 10.7 (Lion) Unable to load dynamic library

Postby JonB » 05. December 2011 04:51

I don't know if you 'noticed', but in your 'recipe site' s blog there is an unanswered post with you exact error -
look for :
Brian Blocker Says:
November 9th, 2010 at 5:14 pm

not a good sign, eh???

Anyway - it looks like you were on the right track that its a matter of 64 bit vs. 32 bit.

Google this
mach-o but wrong architecture in unknown on line 0

It looks like a tough go...

look in particular @ this one;
http://unrealexpectations.com/blog/2010 ... w-leopard/

Good Luck
8)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7


Return to XAMPP for macOS

Who is online

Users browsing this forum: No registered users and 18 guests