php7 install imagick extension

ubuntu16 install PHP7 imagick extension

Reminder: An error occurs during the installation process, which is usually caused by the lack of a compilation toolkit. You can install the corresponding toolkit by referring to the first step according to the prompts.

1. Install ImageMagick
wget http://www.imagemagick.org/download/ImageMagick.tar.gz
Unzip to the specified directory [I am here /data/server/other_component/]
tar -zxvf ImageMagick.tar.gz -C /data/server/other_component/
cd ImageMagick-7.0.7-28/
./configure --prefix=/data/server/other_component/ImageMagick-7.0.7-28
make && make install

export PKG_CONFIG_PATH=/data/server/other_component/ImageMagick-7.0.7-28/lib/pkgconfig/ #Set environment variables
 [Restart the computer and go to the next step]

**********************

2. Install imagick

wget http://pecl.php.net/get/imagick-3.4.3.tgz

Unzip to the specified directory [I am here /data/server/other_component/]
tar -zxvf imagick-3.4.3.tgz -C /data/server/other_component/
cd imagick-3.4.3/

/data/server/php7/bin/phpize #Use phpize to generate a configure configuration file, [find phpsize in your PHP installation location]

./configure \
--with-php-config=/data/server/php7/bin/php-config \
--with-imagick=/data/server/other_component/ImageMagick-7.0.7-28

make & make install

After the installation is complete, the following prompts are displayed, indicating that the installation is successful:
root@www:/data/server/other_component/phpredis-4.0.0# make install
Installing shared extensions:     /data/server/php7/lib/php/extensions/no-debug-non-zts-20151012/
root@www:/data/server/other_component/phpredis-4.0.0#

After the installation is complete, configure [Find the location of php.ini to add the extension]:
vi /etc/php/7.0/cli/php.ini
vi /data/server/php7/lib/php.ini  
In both, write the following:
extension=imagick.so


Copy the extension, otherwise the extension will not be seen in the [cli PHP -m] mode:
cp /data/server/php7/lib/php/extensions/no-debug-non-zts-20151012/imagick.so  /usr/lib/php/20151012/


restart php-fpm
Find PHP service ps aux | grep php-fpm
pkill -9 php
php start command
/data/server/php7/sbin/php-fpm

View extensions
php -m | grep imagick
Tips are as follows
root@www:/data/server/other_component/ImageMagick-7.0.7-28# php -m | grep redis
imagick
root@www:/data/server/other_component/ImageMagick-7.0.7-28#

After the installation is successful, the picture is as follows:


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325903607&siteId=291194637