How to install php-imagick on CentOS 5

ImageMagick is a software suite to create, edit, compose or convert bitmap images. To use this utility in PHP, you'll need to install ImageMagick Linux package and also build and install a PHP extension.

Prerequisite for installing imagick PHP extension is php-pear and gcc packages, so let's get those packages installed.

# yum install php-pear gcc

Now, that you have php-pear and gcc, you may install ImageMagick packages.

# yum install ImageMagick ImageMagick-devel php-devel
# pecl install imagick

Note: You'll not be able to run pecl if you don't have php-pear package installed. To compile imagick, you'll need a GCC compiler as well.

By running the command, you'll install ImageMagick and PHP extension module imagick.so in the /usr/lib/php/modules folder. If you have a 64-bit machine, the modules directory will be /usr/lib64/php/modules.

Edit the /etc/php.d/imagick.ini, and add the following line.

extension=imagick.so

Restart apache, by ...

# service httpd restart

That's all there is to it.

Tags: 

Comments

You will have to install "php-devel" package in order for it to work in Centos 6.

# yum install php-devel

Confirmed working on Centos 6.4 with PHP 5.3.3 and 5.4.

By Scott Seong (not verified)

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.