简体   繁体   中英

xampp can't load imagick - incompatible library versions

My goal is to convert pdf files to images so i can use them as thumbnails on a website. I use codeigniter and XAMPP. However Im running into problems when trying to load the php wrapper to image magic. What i have done:

I used brew to install ghostscript(ghostscript: stable 9.14) and imagemagick(imagemagick: stable 6.8.8-9).

After that i proceeded to install imagick 3.1.2 (the php wrapper to imagemagick) with pecl that is bundled with my xampp installation. No problems so far.

I have tested to: convert file.pdf file.jpg, this works fine and without problem.

I have added "extension=imagick.so" to my php.ini

When i look in my phpinfo() imagick isn't listed so i took at look at the php_errors_log:

[25-Apr-2014 19:24:11 Europe/Berlin] PHP Warning: PHP Startup: Unable to load dynamic library '/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts- 20121212/imagick.so' - dlopen(/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20121212/imagick.so, 9): Library not loaded: /usr/local/lib/libfreetype.6.dylib Referenced from: /usr/local/lib/libMagickWand-6.Q16.2.dylib Reason: Incompatible library version: libMagickWand-6.Q16.2.dylib requires version 18.0.0 or later, but libfreetype.6.dylib provides version 17.0.0 in Unknown on line 0

Obviously is the libfreetype.6.dylib not a high enough version, i have the latest XQaurts installed, at least according to my OS which is OS X Mavericks 10.9.2.

I can't seem to locate a libfreetype.6.dylib that is a version 18.0.0 anywhere on the Internet.

I have also tried an older version on homebrew, imagemagick-ruby186, with that version i could not convert the pdf in terminal.

In this thread Incompatible library version: imagick.so requires version 18.0.0 or later, but libfreetype.6.dylib provides version 16.0.0 in Unknown on line 0 there is a similar problem described, however that person is using MAMP and is able to comment out the

/Applications/MAMP/Library/bin/envvars

I can't seem to locate a similar file in the XAMPP stack. Does anyone know where i can find the required version of the libfreetype.6.dylib or any other solution to this problem?

This would be very appreciated. I have been battling this problem for 12 hours now and I would love to start coding my app instead of trying to install stuff.

Hopefully this question can hope others with similar problems.

Best regards, Johan

I think you can run it by PHP way, here is another similar question I anwsered: https://stackoverflow.com/a/60788110/4314240

The details below for you recap:

Check the download about macosx

http://www.imagemagick.org/script/download.php#macosx

Here are steps you can to follow since I'm same Mac developer.

To install imagemagick:

brew install imagemagick

Successfully:

🍺  /usr/local/Cellar/imagemagick/7.0.10-0: 1,487 files, 24.3MB

To install ghostscript:

brew install ghostscript

Successfully:

🍺  /usr/local/Cellar/ghostscript/9.51_1: 671 files, 87.4MB

Find the magick:

which magick

Then:

/usr/local/bin/magick

Try to run it to test a image then you will find it works:

magick origin.jpg converted.png

So let's do it by PHP way

Create a new php file:

sudo touch magick.php

Enter the code which we will use the 'exec' function to run the magick program:

<?php 
shell_exec('magick origin.jpg converted_php.png');
?> 

After that we run it by:

sudo /Applications/XAMPP/xamppfiles/bin/php magick.php

Great, we can see there is a image file converted_php.png !!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM