CentOS 6.5 system compilation and installation PHP extended imagick tutorial

Source: Internet
Author: User

About imagick

Imagick, which can be used by PHP to call the PHP extension of the ImageMagick function. With this extension, PHP can have the same functions as ImageMagick. You can use the APIs provided by ImageMagick to create and modify images. These operations have been encapsulated in extended imagick and finally called the APIs provided by ImageMagick.
 
Practice: Install and compile ImageMagick and imagick extensions

Configuration environment description:

Php installation directory:/usr/local/php5/
Php expansion Directory:/usr/local/php5/lib/php/extensions/no-debug-zts-20100525/
Php. ini configuration file path:/usr/local/php5/lib/php. ini

1. Install the compilation tool

In general, the following dependency packages have been installed when the Apache and PHP environments are installed. You can skip this step.


# Yum install wget make gcc-c ++ zlib-devel openssl-devel pcre-devel perl

2. Install ImageMagick

You can find the latest source code package at http://www.imagemagick.org/download/on the official website.


# Cd/usr/local/src
# Wget http://www.imagemagick.org/download/ImageMagick-6.8.9-7.tar.bz2
# Tar-jxvf ImageMagick-6.8.9-7.tar.bz2
# Cd ImageMagick-6.8.9-7
#./Configure -- prefix =/usr/local/imagemagick
# Make & make install
# Export PKG_CONFIG_PATH =/usr/local/imagemagick/lib/pkgconfig/# set environment variables

3. Install imagick

You can find the appropriate source code package at http://pecl.php.net/package/imagick.

 

# Cd/usr/local/src
# Wget http://pecl.php.net/get/imagick-3.1.1.tgz # Download imagick
# Tar-zxvf imagick-3.1.1.tgz
# Cd imagick-3.1.1
#/Usr/local/php5/bin/phpize # phpize generate configure configuration file
#./Configure -- with-imagick =/usr/local/imagemagick -- with-php-config =/usr/local/php5/bin/php-config
# Make & make install

After the installation is complete, the following message is displayed:

Installing shared extensions:/usr/local/php5/lib/php/extensions/no-debug-zts-20100525/
Installing header files:/usr/local/php5/include/php/

4. Modify the php configuration to support imagick.

# Edit the configuration file and add the following content


# Vim/usr/local/php5/etc/php. ini
Extension = "imagick. so"
Or
# Echo 'extension = "imagick. so" '>/usr/local/php5/etc/php. ini

5. Restart to take effect

Reload the expansion module. If you use Apache:


# Service httpd restart

If Nginx is used


# Service php-fpm restart

Check whether the expansion takes effect


#/Usr/local/php5/bin/php-m | grep imagick

Imagick

Or view phpinfo ();

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.