11

I need to install imagick extension for php. I have already installed Image Magick. Then I did "sudo pecl install imagick". After this I had such output in console:

Installing '/usr/include/php/ext/imagick/php_imagick.h'
Installing '/usr/include/php/ext/imagick/php_imagick_defs.h'
Installing '/usr/include/php/ext/imagick/php_imagick_shared.h'
Installing '/usr/lib/php/extensions/no-debug-non-zts-20090626/imagick.so'

but as I'm using XAMPP, my extension dir( as I understand ) is /Applications/XAMPP/xamppfiles/lib/php/php-5.3.1/extensions/no-debug-non-zts-20090626. So what should I do to make this working, I tried to put .so file in extensions dir and to add extension=imagick.so record in php.ini and to restart apache, unfortunately this didn't work. Forgot to mention, I'm using osX and XAMPP

user801255
  • 607
  • 1
  • 8
  • 23

2 Answers2

1

I followed @Nodashi link: 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 !!

Oliver Guo
  • 166
  • 9
  • 1
    This is incorrect. The question is specifically about installing **Imagick** which is a PHP binding to **ImageMagick**, whereas this answer is about *"shelling out"* to command-line **ImageMagick**. – Mark Setchell Apr 21 '20 at 07:22
0

Did you install ImageMagick that is required to use imagick : ImageMagick for MacOSx

Chance Smith
  • 1,211
  • 1
  • 15
  • 32
Nodashi
  • 19
  • 1
  • yes, I installed Image Magick. And had no errors during installation process of both imagick and Image Magick – user801255 Nov 15 '11 at 15:40