Linux under the PHP installation Imagick expansion tutorial

Source: Internet
Author: User
Tags imagemagick ini phpinfo

Php_imagick is a php extension that can be used by PHP to invoke the ImageMagick feature. Using this extension allows PHP to have the same functionality as ImageMagick, now let's look at how PHP installs Imagick under Linux.

Description:
PHP installation directory:/USR/LOCAL/PHP5
php.ini configuration file path:/usr/local/php5/etc/php.ini
Nginx installation directory:/usr/local/nginx
Nginx Web site root:/usr/local/nginx/html

1, install compilation tool
Yum install wget make gcc gcc-c++ gtk+-devel zlib-devel openss L openssl-devel pcre-devel kernel keyutils patch perl

2, installing ImageMagick
System operation Dimension www.osyunwei.com warm reminder: qihang01 original content copyright, reprint please specify the source and the original link
cd/usr/local/src# into the package storage directory
wgethttp:// www.imagemagick.org/download/ImageMagick.tar.gz# download ImageMagick
Tar zxvf imagemagick.tar.gz# extract
CD imagemagick-6.7.9-3# into the installation directory
./configure--prefix=/usr/local/imagemagick# configuration
make# compiling
make install# installation
Export pkg_config_path=/usr/local/imagemagick/lib/pkgconfig/#设置环境变量

3, install Imagick
CD/USR/LOCAL/SRC
wgethttp://pecl.php.net/get/imagick-3.0.1.tgz# download Imagick
Tar zxvf imagick-3.0.1.tgz
cd imagick-3.0.1
/usr /local/php5/bin/phpize# phpize Build Configure configuration file
./configure--with-php-config=/usr/local/php5/bin/php-config-- With-imagick=/usr/local/imagemagick# Configure
make# compile
Make install# installation
Note: An error occurred during the installation process, typically due to the lack of a compilation toolkit, you can follow the prompts to install the appropriate toolkit by referring to the first step
after the installation is complete , the following interface appears, remembering the path below, which will be followed by the
Installing shared extensions:/usr/local/php5/lib/php/extensions/ no-debug-non-zts-20090626/#imagick模块路径

4, configure PHP support Imagick
vi/usr/local/php5/etc/php.ini# edit configuration file, On the last line, add the following
extension= "imagick.so"

5, Test
vi/usr/local/nginx/html/phpinfo.php# Edit, enter the following code
< PHP
Phpinfo ();

wq! #保存退出
vi/usr/local/nginx/html/imagick.php# Edit, enter the following code
<? PHP
Header (' Content-type: Image/jpeg ');
$image = new Imagick (' www.osyunwei.com.jpg ');
//If 0 is provided as a width or height parameter,
//aspect ratio is maintained
$image->thumbnailimage (3 00, 225);
Echo $image;
?

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.