Install ImageMagick and php imagick extension under linux and windows

藏色散人
Release: 2023-04-09 15:18:01
forward
3484 people have browsed it

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
Copy after login
  • Unzip
    tar -xvfz ImageMagick.tar.gz
    Copy after login
  • Enter Directory
    cd ImageMagick-7.0.10-28
    Copy after login
  • Set the installation path. You will need to use it later to install the PHP extension;/usr/local/imagemagick
    ./configure --prefix=/usr/local/imagemagick
    Copy after login
  • Compile
    make && make install
    Copy after login
    Copy after login

    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
    Copy after login
  • Unzip the installation package
    tar -zxvf imagick-3.4.4.tgz
    Copy after login
  • Enter the installation file
    cd imagick-3.4.4.tgz/
    Copy after login
  • Execute the phpize command
    /usr/local/php/bin/phpize
    Copy after login
  • 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
    Copy after login
  • Execute configure configuration
    ./configure --with-php-config=/usr/local/php/bin/php-config --with-imagick=/usr/local/imagemagick
    Copy after login
  • Compile
    make && make install
    Copy after login
    Copy after login
  • php.ini and add imagick.so
    extensions=imagick.so
    Copy after login

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 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 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!

Related labels:
php
source:learnku.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!