I have installed ImageMagick using brew install imagemagick
. This all worked fine and I can run any ImageMagick command from the Terminal / Command line.
Now when I try to use the ImageMagick classes in PHP, I get an error Class 'Imagick' not found in ...
. I guess this is because the ImageMagick module is not loaded.
Could anyone help me to get this thing working in PHP? Thanks!
Additional info:
Mac OS X Version: 10.8: Mountain Lion
PHP Version: 5.3.13
From: php error: Class 'Imagick' not found
Did you add
extension=imagick.so
to yourphp.ini
(or/etc/php.d/imagick.ini
) file?I cannot add comments because of reputation, but to add to this anwser:
answered Apr 12 at 16:52
Grzegorz Miśkiewicz
I was getting a missing php.h file, so as per Installing xdebug on MacOs Mojave - 'php.h' file not found I installed the necessary file via the below command:
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
I had the same issue. These are the steps that worked for me if you are using php 5.6
brew install php56-imagick
brew install imagemagick
find /usr/local/Cellar -name "imagick.so"
copy the path from the output of this command into your php.ini file
e.g.
extension=/usr/local/Cellar/php56-imagick/3.3.0_2/imagick.so
save your file. Now to double check that the imagemagick class exists typephp -r "print(class_exists('imagick'));"
Brew symlinking wasn't working for me so I had to put the full pathname into the php.ini file to get it to work. Hope this helps
I've looking for correct way to install imagick on Mojavie and found solution that fully worked.
And now if error occurs like MagicWand not found, edit file Makefile and look for CPPFLAGS = -I/usr/local/opt/imagemagick@6/include/. Inspect if in include folder there is no other folder. In my case it should be like this: CPPFLAGS = -I/usr/local/opt/imagemagick@6/include/ImageMagick-6
save and return to terminal and type make (after finished) sudo make install
imagick.so is located in imagick-3.4.3/imagick-3.4.3/modules
I had the same error having already installed
imagemagick
andphp71-imagick
.brew upgrade imagemagick
- did the trick for me.You may need
sudo
:sudo brew upgrade imagemagick
You may need to restart
apache
/php-fpm
/<other webserver>
.Try: