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
- Code: Select all
sudo port upgrade outdated
3. Made sure that
- Code: Select all
/opt/local/bin
- Code: Select all
/Applications/XAMPP/xamppfiles/bin
- 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
- Code: Select all
echo $PATH
To find, type
- Code: Select all
cd
- Code: Select all
ls -a
- Code: Select all
vi .profile
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
5. Download the imagick PHP extention using PECL by typing in
- Code: Select all
sudo pecl download imagick
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
- Code: Select all
sudo tar -zxvf imagick-[i]versionnumber[/i].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
- 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!