Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I found this article Install imagemagick with PHP imagick extension on CentOS but when I tried to run pecl install imagick I got error when compiling, this is the output of the command:

# pecl install imagick
downloading imagick-3.0.1.tgz ...
Starting to download imagick-3.0.1.tgz (93,920 bytes)
.....................done: 93,920 bytes
13 source files, building
running: phpize
Configuring for:
PHP Api Version:         20100412
Zend Module Api No:      20100525
Zend Extension Api No:   220100525
Please provide the prefix of Imagemagick installation [autodetect] : 
Notice: Use of undefined constant STDIN - assumed 'STDIN' in CLI.php on line 304

Warning: fgets() expects parameter 1 to be resource, string given in CLI.php on line 304

Warning: fgets() expects parameter 1 to be resource, string given in /usr/lib/php/PEAR/Frontend/CLI.php on line 304
building in /root/tmp/pear/pear-build-rootf4XQy0/imagick-3.0.1
running: /root/tmp/pear/imagick/configure --with-imagick
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /usr/local
checking for PHP includes... -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib
checking for PHP extension directory... /usr/local/lib/php/extensions/no-debug-non-zts-20100525
checking for PHP installed headers prefix... /usr/local/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... re2c
checking for re2c version... 0.13.5 (ok)
checking for gawk... gawk
checking whether to enable the imagick extension... yes, shared
checking whether to enable the imagick GraphicsMagick backend... no
checking ImageMagick MagickWand API configuration program... found in /usr/bin/MagickWand-config
checking if ImageMagick version is at least 6.2.4... found version 6.5.4 Q16
checking for MagickWand.h header file... found in /usr/include/ImageMagick/wand/MagickWand.h
checking PHP version is at least 5.1.3... yes. found 5.4.6
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 1966080
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC
checking if cc PIC flag -fPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no

creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
running: make
/bin/sh /root/tmp/pear/pear-build-rootf4XQy0/imagick-3.0.1/libtool --mode=compile cc  -I. -I/root/tmp/pear/imagick -DPHP_ATOM_INC -I/root/tmp/pear/pear-build-rootf4XQy0/imagick-3.0.1/include -I/root/tmp/pear/pear-build-rootf4XQy0/imagick-3.0.1/main -I/root/tmp/pear/imagick -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/usr/include/ImageMagick  -DHAVE_CONFIG_H  -g -O2   -c /root/tmp/pear/imagick/imagick_class.c -o imagick_class.lo
mkdir .libs
 cc -I. -I/root/tmp/pear/imagick -DPHP_ATOM_INC -I/root/tmp/pear/pear-build-rootf4XQy0/imagick-3.0.1/include -I/root/tmp/pear/pear-build-rootf4XQy0/imagick-3.0.1/main -I/root/tmp/pear/imagick -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/usr/include/ImageMagick -DHAVE_CONFIG_H -g -O2 -c /root/tmp/pear/imagick/imagick_class.c  -fPIC -DPIC -o .libs/imagick_class.o
/root/tmp/pear/imagick/imagick_class.c: In function ‘zim_imagick_setfont’:
/root/tmp/pear/imagick/imagick_class.c:1442: error: ‘struct _php_core_globals’ has no member named ‘safe_mode’
/root/tmp/pear/imagick/imagick_class.c:1442: error: ‘CHECKUID_CHECK_FILE_AND_DIR’ undeclared (first use in this function)
/root/tmp/pear/imagick/imagick_class.c:1442: error: (Each undeclared identifier is reported only once
/root/tmp/pear/imagick/imagick_class.c:1442: error: for each function it appears in.)
/root/tmp/pear/imagick/imagick_class.c:1442: error: ‘CHECKUID_NO_ERRORS’ undeclared (first use in this function)
/root/tmp/pear/imagick/imagick_class.c: In function ‘zim_imagick_setimageprogressmonitor’:
/root/tmp/pear/imagick/imagick_class.c:9534: error: ‘struct _php_core_globals’ has no member named ‘safe_mode’
/root/tmp/pear/imagick/imagick_class.c:9534: error: ‘CHECKUID_CHECK_FILE_AND_DIR’ undeclared (first use in this function)
/root/tmp/pear/imagick/imagick_class.c:9534: error: ‘CHECKUID_NO_ERRORS’ undeclared (first use in this function)
make: *** [imagick_class.lo] Błąd 1
ERROR: `make' failed
share|improve this question
    
You are missing some package with headers (usually they have '-devel' in their names). –  Deer Hunter Jan 4 '13 at 7:56
    
@DeerHunter but what package? –  jcubic Jan 4 '13 at 8:02
    
That is a million dollar question... Have a look here though (the first link that DuckDuckGo yielded): bugs.php.net/bug.php?id=61779 –  Deer Hunter Jan 4 '13 at 8:05

2 Answers 2

A preferred method is using the remi repository, which will let you do:

yum install [--enablerepo=remi] php-pecl-imagick

You can find out more about this repository here.

share|improve this answer
    
Using extraofficial repositories has its risks... –  vonbrand Apr 9 '13 at 0:33
up vote 1 down vote accepted

I found solution here: PHP5.4, IMAGEMAGICK & PECL INSTALLATION [UBUNTU]

I needed to run pear config-set preferred_state beta because there where no stable version of imagemagick.

share|improve this answer
    
Congrats on solving your little quandary! Please note however that installing from source is not recommended on CentOS - the preferred way is via RPMs. Other solutions are not scalable, replicatable nor do they contribute to better troubleshooting. –  Deer Hunter Jan 4 '13 at 8:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.