php編譯imagick插件的時候,有時候config階段會報:
checking ImageMagick MagickWand API configuration program... checking Testing /usr/local/bin/MagickWand-config... Doesn't exist checking Testing /usr/bin/MagickWand-config... Doesn't exist checking Testing /usr/sbin/bin/MagickWand-config... Doesn't exist checking Testing /opt/bin/MagickWand-config... Doesn't exist checking Testing /opt/local/bin/MagickWand-config... Doesn't exist checking Testing /opt/homebrew/bin/MagickWand-config... Doesn't exist configure: error: not found. Please provide a path to MagickWand-config or Wand-config program.
缺少magickwand的庫,在ubuntu和debian系統中用以下命令安裝
apt-get install libmagick++-dev
從pecl.php.net/packages/imagick下載源碼包編譯安裝imagick.so
cd ~ && wget https://pecl.php.net/get/imagick-3.7.0.tgz tar zxvf imagick-3.7.0.tgz cd imagick-3.7.0 phpize && ./configure --with-php-config=/usr/local/php/bin/php-config make && make install
完成後,如果出於節省硬盤空間的考慮,也輕易不要完全卸載libmagick的庫,卸載完libmagickwand的庫之後,php會提示因爲基本庫找不到,導致imagick.so無法加載。如果實在空間捉急,可以用以下方式:
apt autoremove libmagick++-dev apt-get install libmagickwand-6.q16-6
這樣只需要消耗130MB來代替600MB的開發庫