July 2, 2009 by  

[HowTo] Install ImageMagick/Imagick For PHP On Ubuntu

PHP LogoInstalling ImageMagick on Ubuntu with PECL is really simple. But i want to share with you how to install it beside to remind myself someday, if i forget how to install it. ImageMagick is a php library for image processing. But they are not developed just for PHP library only, now they have library for Ruby, Perl, Phyton, etc. You can visit their official website here.

Let’s continue to how to install ImageMagick/Imagick on Ubuntu:
1. Open your terminal
2. Install php-pear if you don’t install it yet with this command:

sudo apt-get install php-pear php5-dev

3. Install ImageMagick with this command:

sudo apt-get install imagemagick libmagickwand-dev

4. Install imagick with pecl, with this command:

sudo pecl install imagick

5. Open your php.ini and add this line:
extension=imagick.so

That’s it, now you can use ImageMagick library in PHP. Have a nice day…

What people search:

Post comment as twitter logo facebook logo
Sort: Newest | Oldest
Gwyneth Llewelyn 9 pts

Note that sometimes Ubuntu (specially Ubuntu Server) will only add the required imagick.ini file for PHP CLI but *not* for Apache2. You might need a last manual step like this:

 

cp /etc/php5/cli/conf.d/imagick.ini /etc/php5/apache2/conf.d

 

Just check if phpinfo() *on a Web page* will return the information that ImageMagick is compiled into PHP. If not, try the above command.

ivankrisdotcom 14 pts moderator

 Gwyneth Llewelyn Thanks for the tips.

Then, if you wish to upgrade to the latest beta (which compiles cleanly), download it from : http://pecl.php.net/package/imagick and use pecl to install it with "pecl install {name of downloaded file}"

Install the module without building it manually by doing "apt-get install php5-imagick"

Then, if you wish to upgrade to the latest beta (which compiles cleanly), download it from : http://pecl.php.net/package/imagick and use pecl to install it with "pecl install {name of downloaded file}"

Install the module without building it manually by doing "apt-get install php5-imagick"

I'm in the same place as Travis. I have the newest version of libmagickwand-dev and I get the same error for libmagick9-dev which I am hoping will ultimately fix the make error

I'm in the same place as Travis. I have the newest version of libmagickwand-dev and I get the same error for libmagick9-dev which I am hoping will ultimately fix the make error

i think you missed to install: libmagickwand-dev
run this
sudo apt-get installl libmagickwand-dev

Hi, again, Ivan

When I ran libmagick9-dev, it said:
You should explicitly select one to install.
E: Package libmagick9-dev has no installation candidate

it still gave me the same error when i installed imagick. Here's the pastebin link: http://pastebin.com/m74ca08ae

:(
travis

Hi trav,
please run this command:
sudo apt-get install libmagick9-dev

then re-run
sudo pecl install imagick

Cheers.

i think you missed to install: libmagickwand-dev
run this
sudo apt-get installl libmagickwand-dev

hello, mister ivan! im having issues after doing: the last part of the 3-line installing imagick: "sudo pecl install imagick", gave me this error:

make: *** [imagick_helpers.lo] Error 1
ERROR: `make' failed

i have installed php5-dev package.
what do i do first? =( my box is ubuntu 9. i'm assuming there was a remaining incomplete install in the box since it gave that error. how do i clean it first? or do i have to do that? i'm really the noob of all noobs.

thank you!

travis

Hi, again, Ivan

When I ran libmagick9-dev, it said:
You should explicitly select one to install.
E: Package libmagick9-dev has no installation candidate

it still gave me the same error when i installed imagick. Here's the pastebin link: http://pastebin.com/m74ca08ae

:(
travis

Hi trav,
please run this command:
sudo apt-get install libmagick9-dev

then re-run
sudo pecl install imagick

Cheers.

hello, mister ivan! im having issues after doing: the last part of the 3-line installing imagick: "sudo pecl install imagick", gave me this error:

make: *** [imagick_helpers.lo] Error 1
ERROR: `make' failed

i have installed php5-dev package.
what do i do first? =( my box is ubuntu 9. i'm assuming there was a remaining incomplete install in the box since it gave that error. how do i clean it first? or do i have to do that? i'm really the noob of all noobs.

thank you!

travis

Thinks Ivan for your help. Everything works perfectly now.

Thinks Ivan for your help. Everything works perfectly now.

Thinks a lot for you tutorial but I have a problem. When I executed the command sudo pecl install imagick i got this error:

downloading imagick-2.2.2.tgz ...
Starting to download imagick-2.2.2.tgz (77,212 bytes)
..................done: 77,212 bytes
11 source files, building
running: phpize
sh: phpize: not found
ERROR: `phpize' failed

Can you help me with this?

Hi Mehdi,
Please be sure you install php5-dev package.
or you can use this command for ubuntu/debian: sudo apt-get install php5-dev
Note: if you use php4, use install php4-dev instead.

Thinks a lot for you tutorial but I have a problem. When I executed the command sudo pecl install imagick i got this error:

downloading imagick-2.2.2.tgz ...
Starting to download imagick-2.2.2.tgz (77,212 bytes)
..................done: 77,212 bytes
11 source files, building
running: phpize
sh: phpize: not found
ERROR: `phpize' failed

Can you help me with this?

Hi Mehdi,
Please be sure you install php5-dev package.
or you can use this command for ubuntu/debian: sudo apt-get install php5-dev
Note: if you use php4, use install php4-dev instead.