Home>Article>Backend Development> Install ImageMagick and php imagick extension under linux and windows

Install ImageMagick and php imagick extension under linux and windows

藏色散人
藏色散人 forward
2020-09-10 09:48:22 3467browse

Recommended: "PHP Video Tutorial"

First of all, you need to install two things, one is ImageMagick and the other is the PHP extension 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 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 of 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

  • Required 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 inD:\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.dlland 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.DLLfiles in the ext directory will be the other.dllsuffixed files in theimagickdirectory after decompression. Copy and paste all the files into the php root directory
  • php.inifile and open it for editing, add the lineextension=php_imagick.dll

    Restart service

The above is the detailed content of Install ImageMagick and 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