Written by James McDonald

June 18, 2018

On a brew installed php7.2 on my MacOS 10.13.5 I get an error when running /usr/local/php5/bin/php from the command line:

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

Apparently you install php72-imagick differently these days as per this stack overflow answer: https://stackoverflow.com/a/50364995

I found I had to run the commands using sudo because my /usr/local couldn’t be written by my user and the pecl channel needs updating:

sudo pecl channel-update pecl.php.net
sudo brew update # check for new formulas
sudo brew upgrade # pull down the latest of everything for your brew environment
sudo brew install php # not needed if already installed
sudo brew install imagemagick # not needed if already installed
sudo pecl install imagick
# after the above you can then run php without all the missing imagick error messages
/usr/local/php5/bin/php -v
PHP 7.2.2 (cli) (built: Feb  1 2018 13:23:34) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.2, Copyright (c) 1999-2018, by Zend Technologies
    with Xdebug v2.6.0, Copyright (c) 2002-2018, by Derick Rethans


Submit a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.

You May Also Like…