当前位置:网站首页>Install the imagemagick7.1 library and the imageick extension for PHP

Install the imagemagick7.1 library and the imageick extension for PHP

2022-06-24 15:52:00 Chicken with vegetables, Lee

because ImageMagick7 The following is not supported heic Wait for the picture format , So it was reinstalled ImageMagick7.1 Versioning support heic Format , And write this article to record .
If you encounter some unknown errors during installation ,https://imagemagick.org/script/download.php You can go to the official website to see the documents for solution , Or the comments .

stay Linux(centos7) Installation on ImageMagick7.1 Libraries and php Of Imagick Expand

1. stay Linux Installation on ImageMagick7.1

Before installation, you need to configure pkg-config, In order to ImageMagick Some optional delegate libraries can be found on your system

PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/lib64/pkgconfig:/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib:/usr/lib64:/usr/local/lib:/usr/local/lib64
export LD_LIBRARY_PATH

Install dependency library ( I only install heic(heif) Dependence , Other formats are installed similarly )
install x265(libheif rely on )

wget https://www.nasm.us/pub/nasm/releasebuilds/2.13.03/nasm-2.13.03.tar.gz
tar -zxvf nasm-2.13.03.tar.gz  
cd nasm-2.13.03 
./autogen.sh && ./configure && make && make install

install libheif rely on

wget https://github.com/strukturag/libheif/releases/download/v1.12.0/libheif-1.12.0.tar.gz

tar -zxvf libheif-1.12.0.tar.gz
cd libheif-1.12.0
./autogen.sh && ./configure && make && make install

Final installation ImageMagick

wget https://imagemagick.org/archive/ImageMagick-7.1.0-39.tar.gz
tar -zxvf ImageMagick-7.1.0-39.tar.gz
cd ImageMagick-7.1.0-39
./configure && make && make install

Set the environment variable

echo "export PATH=$PATH:/usr/local/ImageMagick/bin" >> /etc/profile
// If you need to remove the old version 
yum remove ImageMagick -y
// Load environment variables 
source /etc/profile
// Verify that the version was successfully installed 
convert -version
// View the list of supported formats 
convert -list format
 If an error is reported during compilation 

error: 'libraw_output_params_t' has no member named 'no_interpolation'
You need to upgrade your libraw edition

// Uninstall the current libraw
yum remove libraw
// Install a later version of libraw 
(rpm Installation command )
rpm -ivh https://mirrors.tuna.tsinghua.edu.cn/centos/7/os/x86_64/Packages/LibRaw-0.19.4-1.el7.x86_64.rpm
(yum Installation command )
yum localinstall -y https://mirrors.tuna.tsinghua.edu.cn/centos/7/os/x86_64/Packages/LibRaw-0.19.4-1.el7.x86_64.rpm

After installation, edit again

2. install PHP Of Imagick Expand

// download 、 decompression 、 install imagick-3.4.4
wget https://pecl.php.net/get/imagick-3.4.4.tgz

tar -zxvf imagick-3.4.4.tgz

cd imagick-3.4.4.tgz/

/usr/local/php/bin/phpize

//ImageMagick 6.8 The above version directory is /usr/local/include/ImageMagick-X, stay configure Before doing the next soft connection 
ln -s /usr/local/imagemagick/include/ImageMagick-7 /usr/local/imagemagick/include/ImageMagick

./configure --with-php-config=/usr/local/php/bin/php-config --with-imagick=/usr/local/imagemagick

make && make install

Last in php.ini Add imagick.so Just expand

extensions=imagick.so
By upgrading ImageMagick7 Support heic Format processing , Because our server is aws Of , There are twists and turns in the installation process . Fortunately, the installation was completed successfully . I hope to record the process , Give some help to friends in need .

Blog address :https://www.goldenleek.top

Welcome to harass ~

原网站

版权声明
本文为[Chicken with vegetables, Lee]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/175/202206241356042163.html