Home  >  Article  >  Operation and Maintenance  >  How to install ImageMagick and its php imagick extension under linux and windows

How to install ImageMagick and its php imagick extension under linux and windows

coldplay.xixi
coldplay.xixiforward
2020-08-28 17:03:542043browse

How to install ImageMagick and its php imagick extension under linux and windows

[Related article recommendations: linux tutorial]

First of all, you need to install two things, one is ImageMagick and the other is PHP Extend imagick

Linux installation

Install ImageMagick first

  • Download the ImageMagick installation package
    wget http://www.imagemagick.org/download/ImageMagick.tar.gz
  • Unzip
    tar -xvfz ImageMagick.tar.gz
  • Enter the directory
    cd ImageMagick-7.0.10-28
  • Set the installation path. You will need to use it later to install the php extension;/usr/local/imagemagick
    ./configure --prefix=/usr/local/imagemagick
  • Compile
    make && make install

    PHP imagick extension installation (second step)

    Official website address: pecl.php.net/package/imagick
  • Download imagick-3.4.4
    wget https://pecl.php.net/get/imagick-3.4.4.tgz
  • Unzip the installation package
    tar -zxvf imagick-3.4.4.tgz
  • Enter the installation file
    cd imagick-3.4.4.tgz/
  • Execute the phpize command
    /usr/local/php/bin/phpize
  • The directory for ImageMagick 6.8 and above is /usr/local/include/ImageMagick-X, make a soft connection before configure
    ln -s /usr/local/imagemagick/include/ImageMagick-7 /usr/local/imagemagick/include/ImageMagick
  • Execute configure configuration
    ./configure --with-php-config=/usr/local/php/bin/php-config --with-imagick=/usr/local/imagemagick
  • Compile
    make && make install
  • php.ini and add imagick.so
    extensions=imagick.so

Install under Windows

Original link

  • To download the extension, you need to know your PHP version. After viewing the information in the red box through phpinfo(),

    will be used to
  • Download the imagemagick program
    Address: http://windows.php.net/downloads/pecl /deps/
    Download the corresponding version in this area. Select the highest version. I need to download the 64-bit version of vc15

    Install the imagemagick program

  • Download this compressed package and put it in any drive letter. Note that the path should not contain Chinese or special characters. My phpstudy integrated environment is placed in D:\phpstudy_pro\imagemagick. This can be placed arbitrarily.
  • Then configure the environment variables. Refer to the picture below

    Import the DLL file
    In the downloaded file, enter the bin directory. Then search for .dll and copy all the files to the root directory of PHP

    Search - Select All - Copy

    Done

    Download Imagick extension

    Two download addresses are given here. If it does not work, please search again
    Download address one: http://windows.php.net/downloads/pecl/releases/imagick/
    Download address two: https://pecl.php.net/package/imagick
  • After decompression, find the php_imagick.dll file at the bottom and copy it to the PHP root directory. The
  • other .DLL files in the ext directory will be the other .dll suffixed files in the imagick directory after decompression. Copy and paste all the files into the php root directory
  • ##php.ini file and open it for editing, add the line extension=php_imagick.dll

    Restart the service

Related learning recommendations:

linux video tutorial, php programming

The above is the detailed content of How to install ImageMagick and its php imagick extension under linux and windows. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:learnku.com. If there is any infringement, please contact admin@php.cn delete