I recently wanted to install imagemagick as a php extension on my Debian Squeeze web server. Unfortunately most existing howtos just install it through apt-get install php5-imagick, which of course requires that php itself was also installed trough apt-get. Doesn't fit my case, because I like to build my own PHP :-).
So here's another guide how imagemagick can be installed as a PHP extension on a Debian system (currently Squeeze).
Install pre-requirements (the imagemagick libraries and development files):
apt-get install imagemagick libmagickwand-dev
This will install a ton of dependency packages... As an alternative you can also grab the source code file of imagemagick and compile it yourself.
Now download the PECL package of imagemagick, which is called 'imagick'. Check out http://pecl.php.net/package/imagick for new versions.
Unzip/unpack the tgz file and change directory:
tar -xvzf imagick-3.1.0RC2.tgz
The next step is to get information from the currently installed PHP version. All these informations will be gathered trough the program phpize. After this, the compilation is made:
Usually there would be a 'make install' at the end where the imagick extension would be copied to PHP's extension_dir but I prefer to set my own path.
So I created a new folder (/usr/local/imagick) and place the extension manually in there.
cp modules/imagick.so /usr/local/imagick/
Now the extension must be activated in PHP's configuration file php.ini. As I already have ioncube as extension loaded, I just place it below:
# grep "; Extensions" -A 7 /etc/apache2/php.ini
zend_extension = /usr/local/ioncube/ioncube_loader_lin_5.3_ts.so
extension = /usr/local/imagick/imagick.so
Now just an Apache restart and the extension is active.