Installing ImageMagick on CentOS for use with PHP

So, kind of a specific title, but I imagine there are many out there in my shoes.

I set about this task over an hour ago, and just finally came to a solution. So, here’s the scoop.

You’ll see a lot of posts saying, “just pecl install imagick” and you’re off!

Well, it seems that you need to have the actual ImageMagick binary first. Then, once the binary is installed, you’re free to pecl install.

So, long story short, here’s what you need to do to get ImageMagick PHP-ready.

yum --enablerepo remi install ImageMagick ImageMagick-devel
pecl install imagick

Then, add the following to your php.ini

Then restart your Apache and you’re golden!

You may not have the remi repository setup on your system. I swear by it. It seems to provide more up-to-date versions than the default repos.  If you don’t want to use that repo, just remove it from the command.

If you do want to, you can enable the repo with

rpm -Uvh

As seen in my other post: Setting up a new linux server

Why follow me on Twitter?

  • I tweet about new technologies, services or libraries I find interesting
  • Yeah, sometimes I'll post a pet-peeve or rant about something trivial
  • If I discover something that made my web development life easier, I share it
  • I'll shout out any handy tip that I think might be useful to other devs

Tagged , .

Updated: 2016-05-05

Phil LaNasa follow us in feedly