9
votes

I have High Sierra OS - Version 10.13.6 PHP Version: PHP 7.1.9

when I try to do command php -v always appear error like this:

PHP Startup: Unable to load dynamic library '/usr/local/php5-7.1.9-20170914-100859/lib/php/extensions/no-debug-non-zts-20160303/imagick.so' - dlopen(/usr/local/php5-7.1.9-20170914-100859/lib/php/extensions/no-debug-non-zts-20160303/imagick.so, 9): Library not loaded: /usr/local/opt/imagemagick/lib/libMagickWand-7.Q16HDRI.5.dylib
Referenced from: /usr/local/php5-7.1.9-20170914-100859/lib/php/extensions/no-debug-non-zts-20160303/imagick.so Reason: image not found in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library '/usr/local/php5-7.1.9-20170914-100859/lib/php/extensions/no-debug-non-zts-20160303/imagick.so' - dlopen(/usr/local/php5-7.1.9-20170914-100859/lib/php/extensions/no-debug-non-zts-20160303/imagick.so, 9): Library not loaded: /usr/local/opt/imagemagick/lib/libMagickWand-7.Q16HDRI.5.dylib
Referenced from: /usr/local/php5-7.1.9-20170914-100859/lib/php/extensions/no-debug-non-zts-20160303/imagick.so Reason: image not found in Unknown on line 0 PHP 7.1.9 (cli) (built: Sep 14 2017 10:05:35) ( NTS ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies with Zend OPcache v7.1.9, Copyright (c) 1999-2017, by Zend Technologies with Xdebug v2.5.3, Copyright (c) 2002-2017, by Derick Rethans

AFAIK, my php.ini failed to load imagick library. I already install Imagick with brew, there is a file imagick.so inside folder /usr/local/php5-7.1.9-20170914-100859/lib/php/extensions/no-debug-non-zts-20160303/.

I already search many sources for this issue, I found many similar issues too in StackOverflow, it seems similar to mine but still not fixed my issue.

I can still run PHP script obviously, but cannot do some manipulation image with Imagick.

2
Looks like usr/local/opt/imagemagick/lib/libMagickWand-7.Q16HDRI.5.dylib is not availableRuben
Ahh, you right. I just checked that directory and libMagickWand-7.Q16HDRI.5.dylib not available. How to make it available, btw?Vive
Have you installed ImageMagick 7 previously? If not, then install it. Some versions of Imagick require ImageMagick 6. So check which version is required. You can install either from Homebrew.fmw42
I think I have installed ImageMagick 7. When I run command brew install imagemagick got result Warning: imagemagick 7.0.8-14 is already installed and up-to-date To reinstall 7.0.8-14, run brew reinstall imagemagickVive

2 Answers

39
votes

Try:

sudo pecl uninstall imagick && sudo pecl install imagick
0
votes

For debugging I suggest you move the dep to a folder easy to debug, such as in /User/<you>/Documents/. You can load it from the absolute path:

extention="/User/<you>/Documents/<project and check if it's a path issue.

I think that you are trying to install the dependency that is older than the current version of PHP, because you are loading the extention from php56 but you are using php71

https://stackoverflow.com/a/50529784/5893008