CentOS编译安装PHP的imagick扩展

发现WordPress后台的站点健康工具提示:缺少一个或多个推荐的模组 可选的模组imagick未被安装或已被禁用

作为一名完美主义者,这个实在不能忍,于是马上着手解决:

下载ImageMagick:wget https://imagemagick.org/download/ImageMagick-6.9.11-14.tar.gz

解压缩包:tar zxf ImageMagick-6.9.11-14.tar.gz

进入源码目录: cd ImageMagick-6.9.11-14

编译安装:./configure --prefix=/usr/local/ImageMagick && make && make install

下载imagick:wget http://pecl.php.net/get/imagick-3.4.4.tgz

解压缩包:tar zxf imagick-3.4.4.tgz

进入源码目录:cd imagick-3.4.4

准备编译环境:/usr/local/php/bin/phpize

编译安装:./configure --with-imagick=/usr/local/ImageMagick --with-php-config=/usr/local/php/bin/php-config && make && make install

vi /usr/local/php/lib/php.ini 添加 extension=imagick.so

安装过程中可能出现的报错以及解决办法

config.status: error: in `/root/ImageMagick-6.9.11-14':
config.status: error: Something went wrong bootstrapping makefile fragments
    for automatic dependency tracking.  Try re-running configure with the
    '--disable-dependency-tracking' option to at least be able to build
    the package (albeit without support for automatic dependency tracking).
See `config.log' for more details

解决办法 yum install make

Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.

解决办法 yum install autoconf

发表评论

电子邮件地址不会被公开。 必填项已用*标注