Install PHP Imagick on Ubuntu

Source: Internet
Author: User
Tags imagemagick
Install PHP Imagick under Ubuntu

1. Install the ImageMagick client software.

??? A) Download:? sudo wget http://www.imagemagick.org/download/ImageMagick.tar.gz

??? B) Unzip:? TAR-XZVF ImageMagick.tar.gz

?????????????????? Cd?? Imagemagick-6.7.1-6

?????????????????? After switching the root user, execute./configure?-prefix=/usr/local/imagemagick?-enable-lzw?-with-modules?&&?make?&&? Make?install

??? C) Successful installation: Check with??? ->? /usr/local/imagemagick/bin/convert-version

??? Show:

Version:imagemagick 6.8.0-1 2012-10-17 Q16 http://www.imagemagick.org
Copyright:copyright (C) 1999-2012 ImageMagick Studio LLC
Features:openmp

?

Add the Conver command to the path. sudo gedit/etc/environment. In path, add:/usr/local/imagemagick/bin. Use source/etc/environment again to make the configuration effective.

?

2. Use the command to test for success. Convert-sample 25%x25% 1.jpg test.jpg, generate thumbnails.

If error: Convert:no decode delegate for this image format ...? It is likely that the ImageMagick dependency package is missing.

?

To http://www.imagemagick.org/download/delegates/find the following download:


Reference website: http://blog.ericlamb.net/2008/11/fix-for-convert-no-decode-delegate-for-this-image-format/


Dependent package Start-----------------------------------------------------------------



1. Installing zlib

Tar zxvf zlib-1.2.5.tar.gz
CD zlib-1.2.5

./configure
Make?
Make install


2. Installing libpng

Tar zxvf libpng-1.4.4.tar.gz
CD libpng-1.4.4

CD scripts/
MV Makefile.linux. /makefile
Cd..
Make
Make install
Note that the makefile here is not built with./configure, but instead directly from the scripts/.


3. Installing FreeType

Tar zxvf freetype-2.1.10.tar.gz
CD freetype-2.1.10
./configure
Make
Make install


4. Install JPEG

Tar zxvf jpegsrc.v8b.tar.gz?
CD jpeg-8b/
./configure--enable-shared
Make
Make Test
Make install
Note that this configure must take the--enable-shared parameter, otherwise, the shared library will not be generated


Then reinstall the compiled ImageMagick.


Dependent package End-----------------------------------------------------------------


3. Start PHP extension for Imagick (download from Http://pecl.php.net/package/imagick)

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


Decompression: Tar zxvf imagick-3.1.0rc2.tgz


PHPIZE:CD imagick-3.1.0rc2/

??????????????? Phpize


Configuring for:
PHP Api Version:???????? 20090626
Zend Module Api No:????? 20090626
Zend Extension Api No:?? 220090626


Configuration compilation:./configure?--with-php-config=/usr/bin/php-config?--With-imagick=/usr/local/imagemagick

??????????????????? Make&&make?install


You may encounter such problems during the compilation process. Magickwand.h:no such file or directory


First make sure that Pkg-config is installed, if it is not installed, install it.

Then, install GTK. (sudo apt-get install libgtk2.0*)

Installation Complete: Export pkg_config_path=/usr/local/imagemagick/lib/pkgconfig/

Then reinstall the PHP extension for Imagick.

Reference: http://www.cnblogs.com/niocai/archive/2011/07/15/2107472.html


4. After the compilation is successful, it will be generated in PHP extension directory imagick.so
My path is/usr/lib/php5/20090626+lfs/.


And then php.ini inside?

extension= "Imagick.so"

Restart Php?phpinfo () see

Installation complete ....



?

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.