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 ();