1,348   Apache Centos PHP RedHat


Installing ImageMagick

First, install following prerequisite php-pear and gcc packages to compile imagick PHP extension.
# yum install php-pear gcc

Once you’ve installed php-pear and gcc packages, you may now install ImageMagick software for PHP and Perl support using Yum command.
# yum install ImageMagick ImageMagick-devel ImageMagick-perl

Next, compile the imagick for PHP extension. To do, simple run the following ‘pecl‘ command. It will install ImageMagick and imagick PHP extension module ‘imagick.so‘ under/usr/lib/php/modules directory. If you are using 64-bit system, the module directory path would be /usr/lib64/php/modules.
# pecl install imagick

WARNING: channel “pecl.php.net” has updated its protocols, use “pecl channel-update pecl.php.net” to update
downloading imagick-3.1.0RC2.tgz …
Starting to download imagick-3.1.0RC2.tgz (93,264 bytes)
…………………done: 93,264 bytes
15 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] :

Note: It will ask you to provide Imagemagick installation prefix, simply hit enter to auto detect.

Now, add the ‘imagick.so‘ extension to ‘/etc/php.ini‘ file.
echo extension=imagick.so >> /etc/php.ini

Next, restart Apache web server. 这个地方现在一般都是Nginx了,所以应该换成:service nginx restart
# service httpd restart

Verify imagick PHP extension by running the following command. You will see imagick extension similar to below.
# php -m | grep imagick


Last, check in phpinfo.php

Leave a Reply

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