centOS 6.7 - 安装imagick php

时间:2016-01-10 10:52:49

标签: php centos6 imagick

尝试安装php的imagick扩展(这是env):

[root@localhost src]# cat /etc/*release*
CentOS release 6.7 (Final)
CentOS release 6.7 (Final)
CentOS release 6.7 (Final)
cpe:/o:centos:linux:6:GA

[root@localhost src]# php -v
PHP 5.3.3 (cli) (built: Jul  9 2015 17:39:00) 
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

---------------

[root@localhost src]# pecl install imagick
downloading imagick-3.3.0.tgz ...
Starting to download imagick-3.3.0.tgz (179,978 bytes)
.................done: 179,978 bytes
17 source files, building
running: phpize
Configuring for:
PHP Api Version:         20090626
Zend Module Api No:      20090626
Zend Extension Api No:   220090626
Please provide the prefix of Imagemagick installation [autodetect] : 
building in /var/tmp/pear-build-armandPkqjM8/imagick-3.3.0
running: /var/tmp/imagick/configure --with-imagick

.....

- 我最终得到了这个错误......任何人都可以提供帮助吗?提前谢谢!

/var/tmp/imagick/imagick.c:3299: error: ‘ZEND_MOD_END’ undeclared here (not in a function)
make: *** [imagick.lo] Error 1
ERROR: `make' failed

2 个答案:

答案 0 :(得分:1)

我遇到了同样的问题。可能的解决方案是按照以下步骤从源代码安装它:

cd /usr/local
wget http://pecl.php.net/get/imagick-3.3.0.tgz
tar zxvf ./imagick-3.3.0.tgz
cd imagick-3.3.0
phpize
./configure
make
make test

然后,你会得到同样的错误。要解决此问题,请编辑未声明变量的文件:

vim /usr/local/imagick-3.3.0/imagick.c

这样的事情:

3298 #endif
3299         // ZEND_MOD_END
3300         {NULL, NULL, NULL}
3301 };
3302 #endif

然后再次尝试运行:

make test
make install

希望这有帮助。

答案 1 :(得分:1)

由于(补丁)php-5.3.3是RHEL / CentOS 6升级所带来的PHP并不总是可行的。为CentOS 6构建imagick pecl模块使用版本3.1.2。

$ pecl install imagick-3.1.2