Howto: Installing Imagick on PHP
I have recently been installing ImageMagick on my server for use on my other site
First to install ImageMagick:
wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz tar zxvf ImageMagick.tar.gz cd ImageMagick- ./configure --prefix=$HOME/local -with-gslib --with-gs-font-dir=/usr/share/fonts/type1/gsfonts/ --without-perl make make install
Usually you would use
--with-perl-options
but for some reason versions of ImageMagick after 6.4.5 don’t , You don’t really need it when using ImageMagick with PHP anyway.Installing Imagick
Installing Imagick. It took a little bit of time but I managed to get it installed. You first need to download, compile & install autoconf & then Imagick.
mkdir ~/source cd ~/source wget ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.63.tar.gz tar xzf autoconf-2.63.tar.gz cd autoconf-2.63 ./configure --prefix=$HOME/source nice -n 19 make make install export PATH=/home/{username}/source/bin:$PATH cd ~/ wget http://pecl.php.net/get/imagick-2.2.2.tgz tar zxvf imagick-2.2.2.tgz cd imagick-2.2.2 phpize ./configure -prefix=$HOME/imagick --with-imagick=$HOME/local --with-php-config=$HOME/php5/bin/php-config make make install
Don’t forget to change
{username}
on line 9 to your username or you’ll get a error.After that it should tell you the path to imagick.so which you need to instuct your PHP.ini to find. Scroll all the way down until you find
extension_dir='./'
and change it to the FULL.path to the folder given by the build of imagick before. Now find the list of extensions which look like ‘;extension=thing_some.dll’ and after the last one add ‘extension=imagick.so’. Now press ESC then colon ‘w’ ‘q’ and enter to quit and save.