php error installing imagick

Tiago Martinho asked:

System – CentOS 7.5.1804

PHP Version – 7.0.3

So, I’m trying to install Imagick in order to be able to render/make an image off the first page of a PDF.

I’m tried to understand how it is setup, but I’m missing something, so I’ll reproduce what I’ve and what I’ve got so far:

After a long list of errors, I got down to these 4 instalations:

sudo rpm -Uvh ImageMagick-7.0.8-9.x86_64.rpm
sudo rpm -Uvh ImageMagick-libs-7.0.8-9.x86_64.rpm 
sudo yum install php70-php-pecl-imagick.x86_64
sudo php go-pear.phar

When I’m trying to run this: sudo /usr/bin/pecl install imagick, it’s giving me the following error:

WARNING: channel “pecl.php.net” has updated its protocols, use “pecl channel-update pecl.php.net” to update
downloading imagick-3.4.3.tgz …
Starting to download imagick-3.4.3.tgz (245,410 bytes)
……………………………………..done: 245,410 bytes
19 source files, building
running: phpize
Can’t find PHP headers in /usr/include/php
The php-devel package is required for use of this command.
ERROR: `phpize’ failed

So, after checking that ‘php-devel’ is somewhat not here, I try to install it and I get this:

Error: Package: php-pecl-jsonc-devel-1.3.10-2.el7.remi.5.6.x86_64 (remi-php56)
Requires: php-pecl-jsonc(x86-64) = 1.3.10-2.el7.remi.5.6
Available: php-pecl-jsonc-1.3.10-1.el7.remi.5.6.x86_64 (remi-php56)
php-pecl-jsonc(x86-64) = 1.3.10-1.el7.remi.5.6

Error: Package: php-pecl-jsonc-1.3.10-2.el7.remi.5.6.x86_64 (remi-php56)

Requires: php(zend-abi) = 20131226-64

Installed: php-common-7.0.31-1.el7.remi.x86_64 (@remi-php70)
php(zend-abi) = 20151012-64
Available: php-common-5.4.16-45.el7.x86_64 (base)
php(zend-abi) = 20100525-64
Available: php-common-5.6.36-1.el7.remi.x86_64 (remi-php56)
php(zend-abi) = 20131226-64
Available: php-common-5.6.37-1.el7.remi.x86_64 (remi-php56)
php(zend-abi) = 20131226-64

Error: Package: php-devel-5.6.37-1.el7.remi.x86_64 (remi-php56)

Requires: php-cli(x86-64) = 5.6.37-1.el7.remi

Installed: php-cli-7.0.31-1.el7.remi.x86_64 (@remi-php70)
php-cli(x86-64) = 7.0.31-1.el7.remi
Available: php-cli-5.4.16-45.el7.x86_64 (base)
php-cli(x86-64) = 5.4.16-45.el7
Available: php-cli-5.6.36-1.el7.remi.x86_64 (remi-php56)
php-cli(x86-64) = 5.6.36-1.el7.remi
Available: php-cli-5.6.37-1.el7.remi.x86_64 (remi-php56)
php-cli(x86-64) = 5.6.37-1.el7.remi

Error: Package: php-pecl-jsonc-1.3.10-2.el7.remi.5.6.x86_64 (remi-php56)

Requires: php(api) = 20131106-64

Installed: php-common-7.0.31-1.el7.remi.x86_64 (@remi-php70)
php(api) = 20151012-64
Available: php-common-5.4.16-45.el7.x86_64 (base)
php(api) = 20100412-64
Available: php-common-5.6.36-1.el7.remi.x86_64 (remi-php56)
php(api) = 20131106-64
Available: php-common-5.6.37-1.el7.remi.x86_64 (remi-php56)
php(api) = 20131106-64

What am I doing wrong/what am I missing?

My answer:


You’ve mixed a whole bunch of manually downloaded RPMs (some built for the wrong versions of PHP, Imagick or other things) and conflicting repositories. Stop now. Don’t manually download RPMs.

You’ve done well to use Remi’s PHP repositories, but you’ve enabled his repo for PHP 5.6, while you say you want PHP 7.0. You need to disable the remi-php56 repo and enable the remi-php71 or remi-php72 repo (7.0 is EOL, don’t use it).

After getting the correct repo enabled, use yum distro-sync to replace all the wrong versions of packages with correct versions of packages. You’ll also need to remove some packages you got from SCL or other repos, such as those with names starting with php70-.

Finally, you can get to installing the package you were looking for:

[[email protected] ~]# yum install php-pecl-imagick
Loaded plugins: product-id, search-disabled-repos, subscription-manager
epel/x86_64/metalink                                     |  14 kB     00:00     
epel                                                     | 3.2 kB     00:00     
error-rl                                                 | 3.0 kB     00:00     
mariadb                                                  | 2.9 kB     00:00     
nginx                                                    | 3.5 kB     00:00     
remi                                                     | 2.9 kB     00:00     
remi-php72                                               | 2.9 kB     00:00     
remi-safe                                                | 2.9 kB     00:00     
rhel-7-server-extras-rpms                                | 3.4 kB     00:00     
rhel-7-server-optional-rpms                              | 3.5 kB     00:00     
rhel-7-server-rpms                                       | 3.5 kB     00:00     
saltstack-salt                                           | 3.0 kB     00:00     
(1/12): epel/x86_64/updateinfo                             | 933 kB   00:00     
(2/12): epel/x86_64/primary                                | 3.6 MB   00:00     
(3/12): mariadb/primary_db                                 |  61 kB   00:00     
(4/12): remi-php72/primary_db                              | 195 kB   00:00     
(5/12): rhel-7-server-extras-rpms/x86_64/primary_db        | 420 kB   00:00     
(6/12): rhel-7-server-extras-rpms/x86_64/updateinfo        | 273 kB   00:00     
(7/12): remi/primary_db                                    | 2.2 MB   00:00     
(8/12): remi-safe/primary_db                               | 1.3 MB   00:01     
(9/12): rhel-7-server-optional-rpms/7Server/x86_64/primary | 7.2 MB   00:00     
(10/12): rhel-7-server-optional-rpms/7Server/x86_64/update | 2.1 MB   00:00     
(11/12): rhel-7-server-rpms/7Server/x86_64/updateinfo      | 2.9 MB   00:00     
(12/12): rhel-7-server-rpms/7Server/x86_64/primary_db      |  55 MB   00:01     
epel                                                                12647/12647
Package php-pecl-imagick-3.4.3-10.el7.remi.7.2.x86_64 already installed and latest version
Nothing to do
[[email protected] ~]#

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.