Install imagick on mac
Asked Answered
F

3

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

Fluent answered 15/11, 2011 at 15:2 Comment(0)
H
0

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

Handknit answered 15/11, 2011 at 15:30 Comment(1)
yes, I installed Image Magick. And had no errors during installation process of both imagick and Image MagickFluent
P
0

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 !!

Poverty answered 21/3, 2020 at 13:3 Comment(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.Headward
V
0

Better to use docker.

FROM php:8.2-fpm-alpine3.19

RUN echo "@edge-main http://nl.alpinelinux.org/alpine/edge/main" >> /etc/apk/repositories \

 && echo "@edge-community http://nl.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories \

&& apk add --no-cache linux-headers \
&& apk add --update alpine-sdk autoconf bash curl imagemagick-dev imagemagick \
&& pecl install imagick \
&& docker-php-ext-install imagick
Vowell answered 8/4 at 7:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.