Install imagemagick as PHP extension in Debian without apt

Written by - 1 comments

Published on - Listed in PHP Linux


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.

wget http://pecl.php.net/get/imagick-3.1.0RC2.tgz

Unzip/unpack the tgz file and change directory:

tar -xvzf imagick-3.1.0RC2.tgz
cd imagick-3.1.0RC2

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:

phpize
./configure
make

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.

mkdir /usr/local/imagick
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
; Extensions

; IONCUBE
zend_extension = /usr/local/ioncube/ioncube_loader_lin_5.3_ts.so

; ImageMagick
extension = /usr/local/imagick/imagick.so

Now just an Apache restart and the extension is active.

/etc/init.d/apache2 restart


Add a comment

Show form to leave a comment

Comments (newest first)

Ă€ngel from wrote on Mar 18th, 2021:

Thank you very much, it's help me.

Greetings


RSS feed

Blog Tags:

  AWS   Android   Ansible   Apache   Apple   Atlassian   BSD   Backup   Bash   Bluecoat   CMS   Chef   Cloud   Coding   Consul   Containers   CouchDB   DB   DNS   Database   Databases   Docker   ELK   Elasticsearch   Filebeat   FreeBSD   Galera   Git   GlusterFS   Grafana   Graphics   HAProxy   HTML   Hacks   Hardware   Icinga   Icingaweb   Icingaweb2   Influx   Internet   Java   KVM   Kibana   Kodi   Kubernetes   LVM   LXC   Linux   Logstash   Mac   Macintosh   Mail   MariaDB   Minio   MongoDB   Monitoring   Multimedia   MySQL   NFS   Nagios   Network   Nginx   OSSEC   OTRS   Office   PGSQL   PHP   Perl   Personal   PostgreSQL   Postgres   PowerDNS   Proxmox   Proxy   Python   Rancher   Rant   Redis   Roundcube   SSL   Samba   Seafile   Security   Shell   SmartOS   Solaris   Surveillance   Systemd   TLS   Tomcat   Ubuntu   Unix   VMWare   VMware   Varnish   Virtualization   Windows   Wireless   Wordpress   Wyse   ZFS   Zoneminder   


Update cookies preferences